Chapter 9Introducing Monads
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access