11 Monads and functors

This chapter covers

  • Defining functors by generalizing the map operation
  • Deriving general-purpose methods by applying functors
  • Revisiting and formalizing the functor law
  • Defining combinators that constitute monads
  • Proving the laws that govern monads

Many of us break out in cold sweat on hearing the word monad. We have visions of people in lofty ivory towers, wholly disconnected from reality, looking down on the rest of humanity with disdain. We hear them mumbling academic concepts that have little or no bearing on the real world.

Even though many have used this word in such ways, we hope to show you that it could not be further from the truth. The monad concept is pragmatic and can transform the way we write code. Granted, ...

Get Functional Programming in Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.