July 2023
Intermediate to advanced
670 pages
17h 13m
English
Over the last two chapters, you learned about the the Functor and Monad type classes by writing code that interacted with the real world using IO. Although IO is a great introduction to these type classes, there are many other ways that Functor and Monad are useful that have nothing to do with side effects or IO.
Monad in particular has a bit of a reputation in Haskell as being both extremely important as well as difficult to learn. Throughout this chapter, you’ll work your way up to creating your own Monad type class and writing your own Monad instances incrementally. In the process, you’ll learn the hows and whys that will remove some of the mystery from the type class.
Before we can dive into the details of monads ...