W3cubDocs

/Haskell 9

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 Haskell2010

Description

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

Lifting an applicative

data Lift (f :: Type -> Type) a Source

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

Constructors

Pure a
Other (f a)
Instances
Instances details
Generic1 (Lift f :: Type -> Type) Source
Instance details

Defined in Control.Applicative.Lift

Associated Types

type Rep1 (Lift f :: Type -> Type)
Instance details

Defined in Control.Applicative.Lift

type Rep1 (Lift f :: Type -> Type) = D1 ('MetaData "Lift" "Control.Applicative.Lift" "transformers-0.6.1.2-72bd" 'False) (C1 ('MetaCons "Pure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1) :+: C1 ('MetaCons "Other" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))

Methods

from1 :: Lift f a -> Rep1 (Lift f) a

to1 :: Rep1 (Lift f) a -> Lift f a

Foldable1 f => Foldable1 (Lift f) Source
Instance details

Defined in Control.Applicative.Lift

Methods

fold1 :: Semigroup m => Lift f m -> m Source

foldMap1 :: Semigroup m => (a -> m) -> Lift f a -> m Source

foldMap1' :: Semigroup m => (a -> m) -> Lift f a -> m Source

toNonEmpty :: Lift f a -> NonEmpty a Source

maximum :: Ord a => Lift f a -> a Source

minimum :: Ord a => Lift f a -> a Source

head :: Lift f a -> a Source

last :: Lift f a -> a Source

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Lift f a -> b Source

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Lift f a -> b Source

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Lift f a -> b Source

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Lift f a -> b Source

Eq1 f => Eq1 (Lift f) Source
Instance details

Defined in Control.Applicative.Lift

Methods

liftEq :: (a -> b -> Bool) -> Lift f a -> Lift f b -> Bool Source

Ord1 f => Ord1 (Lift f) Source
Instance details

Defined in Control.Applicative.Lift

Methods

liftCompare :: (a -> b -> Ordering) -> Lift f a -> Lift f b -> Ordering Source

Read1 f => Read1 (Lift f) Source
Instance details

Defined in Control.Applicative.Lift

Methods

liftReadsPrec :: (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) Source
Instance details

Defined in Control.Applicative.Lift

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Lift f a -> ShowS Source

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Lift f a] -> ShowS Source

Alternative f => Alternative (Lift f) Source

A combination is Pure only either part is.

Instance details

Defined in Control.Applicative.Lift

Methods

empty :: Lift f a

(<|>) :: Lift f a -> Lift f a -> Lift f a

some :: Lift f a -> Lift f [a]

many :: Lift f a -> Lift f [a]

Applicative f => Applicative (Lift f) Source

A combination is Pure only if both parts are.

Instance details

Defined in Control.Applicative.Lift

Methods

pure :: a -> Lift f a

(<*>) :: Lift f (a -> b) -> Lift f a -> Lift f b

liftA2 :: (a -> b -> c) -> Lift f a -> Lift f b -> Lift f c

(*>) :: Lift f a -> Lift f b -> Lift f b

(<*) :: Lift f a -> Lift f b -> Lift f a

Functor f => Functor (Lift f) Source
Instance details

Defined in Control.Applicative.Lift

Methods

fmap :: (a -> b) -> Lift f a -> Lift f b

(<$) :: a -> Lift f b -> Lift f a

Foldable f => Foldable (Lift f) Source
Instance details

Defined in Control.Applicative.Lift

Methods

fold :: Monoid m => Lift f m -> m

foldMap :: Monoid m => (a -> m) -> Lift f a -> m

foldMap' :: Monoid m => (a -> m) -> Lift f a -> m

foldr :: (a -> b -> b) -> b -> Lift f a -> b

foldr' :: (a -> b -> b) -> b -> Lift f a -> b

foldl :: (b -> a -> b) -> b -> Lift f a -> b

foldl' :: (b -> a -> b) -> b -> Lift f a -> b

foldr1 :: (a -> a -> a) -> Lift f a -> a

foldl1 :: (a -> a -> a) -> Lift f a -> a

toList :: Lift f a -> [a]

null :: Lift f a -> Bool

length :: Lift f a -> Int

elem :: Eq a => a -> Lift f a -> Bool

maximum :: Ord a => Lift f a -> a

minimum :: Ord a => Lift f a -> a

sum :: Num a => Lift f a -> a

product :: Num a => Lift f a -> a

Traversable f => Traversable (Lift f) Source
Instance details

Defined in Control.Applicative.Lift

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Lift f a -> f0 (Lift f b)

sequenceA :: Applicative f0 => Lift f (f0 a) -> f0 (Lift f a)

mapM :: Monad m => (a -> m b) -> Lift f a -> m (Lift f b)

sequence :: Monad m => Lift f (m a) -> m (Lift f a)

Generic (Lift f a) Source
Instance details

Defined in Control.Applicative.Lift

Associated Types

type Rep (Lift f a)
Instance details

Defined in Control.Applicative.Lift

type Rep (Lift f a) = D1 ('MetaData "Lift" "Control.Applicative.Lift" "transformers-0.6.1.2-72bd" 'False) (C1 ('MetaCons "Pure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Other" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))

Methods

from :: Lift f a -> Rep (Lift f a) x

to :: Rep (Lift f a) x -> Lift f a

(Read1 f, Read a) => Read (Lift f a) Source
Instance details

Defined in Control.Applicative.Lift

Methods

readsPrec :: Int -> ReadS (Lift f a)

readList :: ReadS [Lift f a]

readPrec :: ReadPrec (Lift f a)

readListPrec :: ReadPrec [Lift f a]

(Show1 f, Show a) => Show (Lift f a) Source
Instance details

Defined in Control.Applicative.Lift

Methods

showsPrec :: Int -> Lift f a -> ShowS

show :: Lift f a -> String

showList :: [Lift f a] -> ShowS

(Eq1 f, Eq a) => Eq (Lift f a) Source
Instance details

Defined in Control.Applicative.Lift

Methods

(==) :: Lift f a -> Lift f a -> Bool

(/=) :: Lift f a -> Lift f a -> Bool

(Ord1 f, Ord a) => Ord (Lift f a) Source
Instance details

Defined in Control.Applicative.Lift

Methods

compare :: Lift f a -> Lift f a -> Ordering

(<) :: Lift f a -> Lift f a -> Bool

(<=) :: Lift f a -> Lift f a -> Bool

(>) :: Lift f a -> Lift f a -> Bool

(>=) :: Lift f a -> Lift f a -> Bool

max :: Lift f a -> Lift f a -> Lift f a

min :: Lift f a -> Lift f a -> Lift f a

type Rep1 (Lift f :: Type -> Type) Source
Instance details

Defined in Control.Applicative.Lift

type Rep1 (Lift f :: Type -> Type) = D1 ('MetaData "Lift" "Control.Applicative.Lift" "transformers-0.6.1.2-72bd" 'False) (C1 ('MetaCons "Pure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1) :+: C1 ('MetaCons "Other" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
type Rep (Lift f a) Source
Instance details

Defined in Control.Applicative.Lift

type Rep (Lift f a) = D1 ('MetaData "Lift" "Control.Applicative.Lift" "transformers-0.6.1.2-72bd" 'False) (C1 ('MetaCons "Pure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Other" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (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 :: 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.

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

Convert from Either to Errors (inverse of runErrors).

© 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