Monads

Get familiar with and learn how to use monads.

We'll cover the following

What is a monad?

A monad wraps a value in a similar way to a functor. However, a monad has an additional function, called bind, that:

  • Accepts a single parameter
  • Returns a value wrapped in a monad

Unlike map, the bind function, itself, is responsible for wrapping the return value. This means that the bind function can decide what sort of monad to wrap the result in.

Here is an example, the function, oneover, returns 1x\frac{1}{x}, wrapped in a Just monad:

Get hands-on with 1400+ tech skills courses.