The identity functor and monad.
This trivial type constructor serves two purposes:
It can be used with functions parameterized by functor or monad
classes.
It can be used as a base monad to which a series of monad
transformers may be applied to construct a composite monad. Most monad
transformer modules include the special case of applying the
transformer to Identity. For example, State s is an
abbreviation for StateT s Identity.
The Identity monad is a monad that does not embody any
computational strategy. It simply applies the bound function to its
input without any modification. Computationally, there is no reason to
use the Identity monad instead of the much simpler act of
simply applying functions to their arguments. The purpose of the
Identity monad is its fundamental role in the theory of monad
transformers. Any monad transformer applied to the Identity
monad yields a non-transformer version of that monad.
The Identity monad is a monad that does not embody any
computational strategy. It simply applies the bound function to its
input without any modification. Computationally, there is no reason to
use the Identity monad instead of the much simpler act of
simply applying functions to their arguments. The purpose of the
Identity monad is its fundamental role in the theory of monad
transformers. Any monad transformer applied to the Identity
monad yields a non-transformer version of that monad.