transformers-0.5.0.1: Concrete functor and monad transformers

Copyright(c) Ross Paterson 2010
LicenseBSD-style (see the file LICENSE)
MaintainerR.Paterson@city.ac.uk
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Control.Applicative.Lift

Contents

Description

Adding a new kind of pure computation to an applicative functor.

Synopsis

Lifting an applicative

data Lift f a Source

Applicative functor formed by adding pure computations to a given applicative functor.

Constructors

Pure a 
Other (f a) 

Instances

Functor f => Functor (Lift f) Source 
Applicative f => Applicative (Lift f) Source

A combination is Pure only if both parts are.

Foldable f => Foldable (Lift f) Source 
Traversable f => Traversable (Lift f) Source 
Alternative f => Alternative (Lift f) Source

A combination is Pure only either part is.

Show1 f => Show1 (Lift f) Source 
Read1 f => Read1 (Lift f) Source 
Ord1 f => Ord1 (Lift f) Source 
Eq1 f => Eq1 (Lift f) Source 
(Eq1 f, Eq a) => Eq (Lift f a) Source 
(Ord1 f, Ord a) => Ord (Lift f a) Source 
(Read1 f, Read a) => Read (Lift f a) Source 
(Show1 f, Show a) => Show (Lift f a) Source 

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.

Collecting errors

type Errors e = Lift (Constant e) 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.

runErrors :: Errors e a -> Either e a Source

Extractor for computations with accumulating errors.

failure :: e -> Errors e a Source

Report an error.