Definition

The maybe monad or option monad is the monad on Set whose underlying endofunctor sends a set to the maybe type .

Its unit is the map

given by .

Its multiplication

flattens a nested optional value by sending to and every other case to .

Kleisli Structure

Equivalently, for and , the Kleisli extension is defined to be if and if .

Partiality

The maybe monad represents a simple form of partiality in which definedness is decidable. It is the decidable instance of the lifting pattern.

Lifting Monad
Maybe Type
Monad
Partiality (Type Theory)