There is a place where all the fancy abstractions of functional programming really shine: error handling and data validation. During this talk, we will take a whirlwind tour of what the Scala language, supplemented by the cats library, have to offer in that respect:
Option and Either to expressively represent computation that may fail.
Validated for checking pre-conditions on our programs’ inputs while nicely accumulating all encountered errors.
Then we will see how the “three musketeers of functional programming,” Applicative, Monad and Traverse (along with Functor as d’Artagnan) can help us handle our errors and validate our data in a simple, expressive, and composable way!
The video for this talk given by Valentin Kasas as part of the 47 Degrees Academy can be found here: https://www.youtube.com/watch?v=Hj4fRrlKHeY