Video recording of a talk I gave on functional programming at a Scala Central meetup.
Learning (and subsequently trying to explain) monads has become something of a rite of passage in functional programming. Like many developers, I struggled initially to understand precisely what type of thing monads are, despite using them on an almost daily basis. The most helpful description I have come across is given by Noel Welsh and Dave Gurnell in Scala with Cats:
“A monad is a mechanism for sequencing computations.”
Case classes provide a convenient way of working with immutable objects in scala. Manipulating fields within them can be tedious, however. In this post, we will look at how lenses can be used to abstract over this complexity while preserving the benefits of immutability.