Lesson 4: The Maybe Monad

Contents
  • Exercise
  • Enter the monad
  • TypeApplications
  • Cases and binds
  • Revising main
Video
  • 19 minutes
Tags
case expression pattern matching Maybe Monad

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.