Ответ 1
Lift - относительно новый вклад:
data Lift f a = Pure a | Other (f a)
То есть, учитывая функтор f
, вы можете получить новый функтор, составив f
с чистым значением.
Сам пакет дает пример:
-- | 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)
Однако я не знаю о каких-либо других применениях этого.