Recently I’ve watched an interesting presentation from Martin Odersky on Plain Functional Programming.

In his talk Martin introduced Context functions which let him achieve 2 things.

  1. Pass context to functions without explicitly passing it through function’s arguments
  2. Make function signatures more descriptive - by introducing Possibly he gave the function ability to throw an error

I highly recommend the talk if you want to get familiar with the full reasoning behind Context functions. Also here’s the link to docs about Context functions.

You can check out the sample code for Martin’s presentation here. I have updated the code to the current Scala syntax.

Happy coding 🙂