Skip to contents

Monad

A monadic object is a container for a value, or a value with a context. fmap() encodes what it means to apply a regular function in the context. bind() encodes what it means to apply a monadic function in the context. join() encodes how to flatten a layer of monadic structure.

The %>>% and %>-% operators wrap fmap() and bind() for writing monadic data pipelines.

`%>>%` `%>-%` fmap() bind() join()
Monad Operators and Generics

Laws for Implementations

Implementations of methods for the generics must follow certain rules. Functor Laws establish the requirements for fmap(). Monad Laws establish the requirements for bind().

functor-laws
Functor Laws
monad-laws
Monad Laws

Implementations

Classes that have method implementations for the monad generics.

List
The List Monad
Maybe
The Maybe Monad