Yesterday we looked at FlatMap
and Monad
typeclass. We looked at how monadic chaining can add contexts to values. Because both Option
and List
already have flatMap
in the standard library, it was more about changing the way we see things rather than introducing new code. We also reviewed for
syntax as a way of chaining monadic operations.
Before I jump into the topic, I want to mention Pamflet, the Scala-based blog/book platform I’m using here. Nathan Hamblen (@n8han) started Pamflet and I’ve been contributing features to it too. Speaking of which, the source of these posts are also available on eed3si9n/herding-cats if you’re curious how this is built. A special thanks to Leif Wickland (@leifwickland) for proofreading all of the posts and sending me pull requests with fixes!