In this chapter, we have looked at multiple monads and their implementation. I hope the examples made it clear how you can use them and what their benefits are:
The Maybe monad can be used when a computation might return nothing
The Either monad can be used when a computation might error
The List monad can be used when a computation has multiple possible results
The Writer monad can be used when some side information needs to be passed alongside the return value
The Reader monad can be used to share a common environment between multiple computations
The State monad is a beefed-up version of the Reader monad where the environment can be updated between each computation
The IO monad can be used to perform IO operations in a referentially transparent way
There are, however, multiple other computations that can be simplified using monads. When writing code, I encourage you to take a step back and look at the structure to see if you recognize a monadic pattern. If so, you should probably implement...