Control.Applicative.Lift
Copyright | (c) Ross Paterson 2010 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | [email protected] |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
Contents
Description
Adding a new kind of pure computation to an applicative functor.
Lifting an applicative
Applicative functor formed by adding pure computations to a given applicative functor.
Instances
Functor f => Functor (Lift f) | |
Applicative f => Applicative (Lift f) | A combination is |
Foldable f => Foldable (Lift f) | |
Defined in Control.Applicative.Lift Methodsfold :: Monoid m => Lift f m -> m Source foldMap :: Monoid m => (a -> m) -> Lift f a -> m Source foldMap' :: Monoid m => (a -> m) -> Lift f a -> m Source foldr :: (a -> b -> b) -> b -> Lift f a -> b Source foldr' :: (a -> b -> b) -> b -> Lift f a -> b Source foldl :: (b -> a -> b) -> b -> Lift f a -> b Source foldl' :: (b -> a -> b) -> b -> Lift f a -> b Source foldr1 :: (a -> a -> a) -> Lift f a -> a Source foldl1 :: (a -> a -> a) -> Lift f a -> a Source toList :: Lift f a -> [a] Source null :: Lift f a -> Bool Source length :: Lift f a -> Int Source elem :: Eq a => a -> Lift f a -> Bool Source maximum :: Ord a => Lift f a -> a Source minimum :: Ord a => Lift f a -> a Source | |
Traversable f => Traversable (Lift f) | |
Defined in Control.Applicative.Lift | |
Eq1 f => Eq1 (Lift f) | |
Ord1 f => Ord1 (Lift f) | |
Defined in Control.Applicative.Lift | |
Read1 f => Read1 (Lift f) | |
Defined in Control.Applicative.Lift MethodsliftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Lift f a) Source liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Lift f a] Source liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Lift f a) Source liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Lift f a] Source | |
Show1 f => Show1 (Lift f) | |
Alternative f => Alternative (Lift f) | A combination is |
(Eq1 f, Eq a) => Eq (Lift f a) | |
(Ord1 f, Ord a) => Ord (Lift f a) | |
Defined in Control.Applicative.Lift | |
(Read1 f, Read a) => Read (Lift f a) | |
(Show1 f, Show a) => Show (Lift f a) | |
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
.
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.
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/8.10.2/docs/html/libraries/transformers-0.5.6.2/Control-Applicative-Lift.html