Lift is a relatively new contribution:
data Lift f a = Pure a | Other (f a)
That is, given a functor f
, you can get a new functor by composing f
with a pure value.
The package itself gives an example:
-- | An applicative functor that collects a monoid (e.g. lists) of errors.
-- A sequence of computations fails if any of its components do, but
-- unlike monads made with 'ErrorT' from "Control.Monad.Trans.Error",
-- these computations continue after an error, collecting all the errors.
type Errors e = Lift (Constant e)
-- | Report an error.
failure :: Monoid e => e -> Errors e a
failure e = Other (Constant e)
I don't know of any in-the-wild uses of this, however.