In this recipe, we will define our own Maybe type. We will define the Functor and Applicative instances for our Maybe, which are prerequisites for creating a Monad instance. Then, we will continue to create an instance of Monad, and, finally, we will use them in an example.
Maybe is a simple type and its monad instance is simple to implement and understand. Hence, when we work with the Maybe monad, it becomes clearer why and how the monad works.