| Copyright | (c) Ross Paterson 2010 |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | [email protected] |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Adding a new kind of pure computation to an applicative functor.
data Lift (f :: Type -> Type) a Source
Applicative functor formed by adding pure computations to a given applicative functor.
unLift :: Applicative f => Lift f a -> f a Source
Projection to the other functor.
mapLift :: (f a -> g a) -> Lift f a -> Lift g a Source
Apply a transformation to the other computation.
elimLift :: (a -> r) -> (f a -> r) -> Lift f a -> r Source
Eliminator for Lift.
type Errors e = Lift (Constant e :: Type -> Type) Source
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 ExceptT from Control.Monad.Trans.Except, these computations continue after an error, collecting all the errors.
pure f <*> pure x = pure (f x)
pure f <*> failure e = failure e
failure e <*> pure x = failure e
failure e1 <*> failure e2 = failure (e1 <> e2)
runErrors :: Errors e a -> Either e a Source
Extractor for computations with accumulating errors.
failure :: e -> Errors e a Source
Report an error.
eitherToErrors :: Either e a -> Errors e a Source
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/9.12.1/docs/libraries/transformers-0.6.1.2-72bd/Control-Applicative-Lift.html