Abstraction for wrapping up a object.
If you have an monadic function, say:
example :: Int -> Identity Int
example x = return (x*x)
you can "run" it, using
Main> runIdentity (example 42)
1764 :: Int
A typical use of the Identity monad is to derive a monad
from a monad transformer.
-- derive the State monad using the StateT monad transformer
type State s a = StateT s Identity a
The runIdentity label is used in the type definition because it follows
a style of monad definition that explicitly represents monad values as
computations. In this style, a monadic computation is built up using the monadic
operators and then the value of the computation is extracted
using the run****** function.
Because the Identity monad does not do any computation, its definition
For a better example of this style of monad,
see the State monad.