Lesson 4: The Maybe Monad
- Enter the monad
- Cases and binds
- 19 minutes
We open by looking at a couple of possible solutions to the exercise we left you with last time. We then introduce an operator called “bind”,
>>=, that can be used to reduce nested
case expressions. That allows us to forego the laborious pattern matching and makes for a concise expression; however, there are some drawbacks to this approach as well.
>>= is the principle operator of the
Monad typeclass, we discuss what monads are.