Lesson 4: The Maybe Monad

  • Exercise
  • Enter the monad
  • TypeApplications
  • Cases and binds
  • Revising main
  • 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.

Since >>= is the principle operator of the Monad typeclass, we discuss what monads are.

Sign up for access to the full page, plus the complete archive and all the latest content.