lens-family-core-2.1.3: Haskell 2022 Lens Families

Safe Haskell | Safe-Inferred
Language | Haskell2010

Lens.Family.State.Lazy

Contents

- Compound Assignments
- Strict Assignments
- Types
- Re-exports

Description

Lenses allow you to use fields of the state of a state monad as if they were variables in an imperative language. `use` is used to retrieve the value of a variable, and `.=` and `%=` allow you to set and modify a variable. C-style compound assignments are also provided.

Synopsis

- zoom :: Monad m => LensLike' (Zooming m c) s a -> StateT a m c -> StateT s m c
- use :: Monad m => FoldLike a s t a b -> StateT s m a
- uses :: Monad m => FoldLike r s t a b -> (a -> r) -> StateT s m r
- (%=) :: Monad m => ASetter s s a b -> (a -> b) -> StateT s m ()
- assign :: Monad m => ASetter s s a b -> b -> StateT s m ()
- (.=) :: Monad m => ASetter s s a b -> b -> StateT s m ()
- (%%=) :: Monad m => LensLike (Writer c) s s a b -> (a -> (c, b)) -> StateT s m c
- (<~) :: Monad m => ASetter s s a b -> StateT s m b -> StateT s m ()
- (+=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m ()
- (-=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m ()
- (*=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m ()
- (//=) :: (Monad m, Fractional a) => ASetter' s a -> a -> StateT s m ()
- (&&=) :: Monad m => ASetter' s Bool -> Bool -> StateT s m ()
- (||=) :: Monad m => ASetter' s Bool -> Bool -> StateT s m ()
- (<>=) :: (Monad m, Monoid a) => ASetter' s a -> a -> StateT s m ()
- (%!=) :: Monad m => ASetter s s a b -> (a -> b) -> StateT s m ()
- (+!=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m ()
- (-!=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m ()
- (*!=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m ()
- (//!=) :: (Monad m, Fractional a) => ASetter' s a -> a -> StateT s m ()
- (&&!=) :: Monad m => ASetter' s Bool -> Bool -> StateT s m ()
- (||!=) :: Monad m => ASetter' s Bool -> Bool -> StateT s m ()
- (<>!=) :: (Monad m, Monoid a) => ASetter' s a -> a -> StateT s m ()
- data Zooming m c a
- type LensLike f s t a b = (a -> f b) -> s -> f t
- type LensLike' f s a = (a -> f a) -> s -> f s
- type FoldLike r s t a b = LensLike (Constant r) s t a b
- data Constant a (b :: k)
- type ASetter s t a b = LensLike Identity s t a b
- type ASetter' s a = LensLike' Identity s a
- data Identity a
- data StateT s (m :: Type -> Type) a
- type Writer w = WriterT w Identity

# Documentation

zoom :: Monad m => LensLike' (Zooming m c) s a -> StateT a m c -> StateT s m c Source #

    zoom :: Monad m => Lens' s a -> StateT a m c -> StateT s m c

Lift a stateful operation on a field to a stateful operation on the whole state. This is a good way to call a "subroutine" that only needs access to part of the state.

    zoom :: (Monad m, Monoid c) => Traversal' s a -> StateT a m c -> StateT s m c

Run the "subroutine" on each element of the traversal in turn and `mconcat` all the results together.

    zoom :: Monad m => Traversal' s a -> StateT a m () -> StateT s m ()

Run the "subroutine" on each element the traversal in turn.

use :: Monad m => FoldLike a s t a b -> StateT s m a Source #

    use :: Monad m => Getter s t a b -> StateT s m a

Retrieve a field of the state

    use :: (Monad m, Monoid a) => Fold s t a b -> StateT s m a

Retrieve a monoidal summary of all the referenced fields from the state

uses :: Monad m => FoldLike r s t a b -> (a -> r) -> StateT s m r Source #

    uses :: (Monad m, Monoid r) => Fold s t a b -> (a -> r) -> StateT s m r

Retrieve all the referenced fields from the state and foldMap the results together with `f :: a -> r`.

    uses :: Monad m => Getter s t a b -> (a -> r) -> StateT s m r

Retrieve a field of the state and pass it through the function `f :: a -> r`.

    uses l f = f <$> use l

(%=) :: Monad m => ASetter s s a b -> (a -> b) -> StateT s m () infix 4 Source #

Modify a field of the state.

assign :: Monad m => ASetter s s a b -> b -> StateT s m () Source #

Set a field of the state.

(.=) :: Monad m => ASetter s s a b -> b -> StateT s m () infix 4 Source #

Set a field of the state.

(%%=) :: Monad m => LensLike (Writer c) s s a b -> (a -> (c, b)) -> StateT s m c infix 4 Source #

    (%%=) :: Monad m => Lens s s a b -> (a -> (c, b)) -> StateT s m c

Modify a field of the state while returning another value.

    (%%=) :: (Monad m, Monoid c) => Traversal s s a b -> (a -> (c, b)) -> StateT s m c

Modify each field of the state and return the `mconcat` of the other values.

(<~) :: Monad m => ASetter s s a b -> StateT s m b -> StateT s m () infixr 2 Source #

Set a field of the state using the result of executing a stateful command.

# Compound Assignments

(+=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

(-=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

(*=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

(//=) :: (Monad m, Fractional a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

(&&=) :: Monad m => ASetter' s Bool -> Bool -> StateT s m () infixr 4 Source #

(||=) :: Monad m => ASetter' s Bool -> Bool -> StateT s m () infixr 4 Source #

(<>=) :: (Monad m, Monoid a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

Monoidally append a value to all referenced fields of the state.

# Strict Assignments

(%!=) :: Monad m => ASetter s s a b -> (a -> b) -> StateT s m () infix 4 Source #

Strictly modify a field of the state.

(+!=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

(-!=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

(*!=) :: (Monad m, Num a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

(//!=) :: (Monad m, Fractional a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

(&&!=) :: Monad m => ASetter' s Bool -> Bool -> StateT s m () infixr 4 Source #

(||!=) :: Monad m => ASetter' s Bool -> Bool -> StateT s m () infixr 4 Source #

(<>!=) :: (Monad m, Monoid a) => ASetter' s a -> a -> StateT s m () infixr 4 Source #

# Types

data Zooming m c a Source #

#### Instances

Instances details

(Monoid c, Monad m) => Applicative (Zooming m c) Source # |
Instance details Defined in Lens.Family.State.Zoom Methods pure :: a -> Zooming m c a Source # (<*>) :: Zooming m c (a -> b) -> Zooming m c a -> Zooming m c b Source # liftA2 :: (a -> b -> c0) -> Zooming m c a -> Zooming m c b -> Zooming m c c0 Source # (*>) :: Zooming m c a -> Zooming m c b -> Zooming m c b Source # (<*) :: Zooming m c a -> Zooming m c b -> Zooming m c a Source #
Monad m => Functor (Zooming m c) Source # |
Instance details Defined in Lens.Family.State.Zoom Methods fmap :: (a -> b) -> Zooming m c a -> Zooming m c b Source # (<$) :: a -> Zooming m c b -> Zooming m c a Source #

# Re-exports

type LensLike f s t a b = (a -> f b) -> s -> f t Source #

type LensLike' f s a = (a -> f a) -> s -> f s Source #

type FoldLike r s t a b = LensLike (Constant r) s t a b Source #

data Constant a (b :: k) Source #

Constant functor.

#### Instances

Instances details

Generic1 (Constant a :: k -> Type) |
Instance details Defined in Data.Functor.Constant Associated Types type Rep1 (Constant a) :: k -> Type Source # Methods from1 :: forall (a0 :: k0). Constant a a0 -> Rep1 (Constant a) a0 Source # to1 :: forall (a0 :: k0). Rep1 (Constant a) a0 -> Constant a a0 Source #
Bifoldable (Constant :: Type -> Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods bifold :: Monoid m => Constant m m -> m Source # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Constant a b -> m Source # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Constant a b -> c Source # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Constant a b -> c Source #
Bifunctor (Constant :: Type -> Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods bimap :: (a -> b) -> (c -> d) -> Constant a c -> Constant b d Source # first :: (a -> b) -> Constant a c -> Constant b c Source # second :: (b -> c) -> Constant a b -> Constant a c Source #
Bitraversable (Constant :: Type -> Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Constant a b -> f (Constant c d) Source #
Eq2 (Constant :: Type -> Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> Constant a c -> Constant b d -> Bool Source #
Ord2 (Constant :: Type -> Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> Constant a c -> Constant b d -> Ordering Source #
Read2 (Constant :: Type -> Type -> Type) |

Instance details

Defined in Data.Functor.Constant

Methods

liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Constant a b) Source #

liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Constant a b] Source #

liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Constant a b) Source #

liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Constant a b] Source #

Show2 (Constant :: Type -> Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Constant a b -> ShowS Source # liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [Constant a b] -> ShowS Source #
Foldable (Constant a :: Type -> Type) |

Instance details

Defined in Data.Functor.Constant

Methods

fold :: Monoid m => Constant a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Constant a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Constant a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Constant a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Constant a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Constant a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Constant a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 Source #

toList :: Constant a a0 -> [a0] Source #

null :: Constant a a0 -> Bool Source #

length :: Constant a a0 -> Int Source #

elem :: Eq a0 => a0 -> Constant a a0 -> Bool Source #

maximum :: Ord a0 => Constant a a0 -> a0 Source #

minimum :: Ord a0 => Constant a a0 -> a0 Source #

sum :: Num a0 => Constant a a0 -> a0 Source #

product :: Num a0 => Constant a a0 -> a0 Source #

Eq a => Eq1 (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods liftEq :: (a0 -> b -> Bool) -> Constant a a0 -> Constant a b -> Bool Source #
Ord a => Ord1 (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods liftCompare :: (a0 -> b -> Ordering) -> Constant a a0 -> Constant a b -> Ordering Source #
Read a => Read1 (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Constant a a0) Source # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Constant a a0] Source # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Constant a a0) Source # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Constant a a0] Source #
Show a => Show1 (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> Constant a a0 -> ShowS Source # liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [Constant a a0] -> ShowS Source #
Contravariant (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods contramap :: (a' -> a0) -> Constant a a0 -> Constant a a' Source # (>$) :: b -> Constant a b -> Constant a a0 Source #
Traversable (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods traverse :: Applicative f => (a0 -> f b) -> Constant a a0 -> f (Constant a b) Source # sequenceA :: Applicative f => Constant a (f a0) -> f (Constant a a0) Source # mapM :: Monad m => (a0 -> m b) -> Constant a a0 -> m (Constant a b) Source # sequence :: Monad m => Constant a (m a0) -> m (Constant a a0) Source #
Monoid a => Applicative (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods pure :: a0 -> Constant a a0 Source # (<*>) :: Constant a (a0 -> b) -> Constant a a0 -> Constant a b Source # liftA2 :: (a0 -> b -> c) -> Constant a a0 -> Constant a b -> Constant a c Source # (*>) :: Constant a a0 -> Constant a b -> Constant a b Source # (<*) :: Constant a a0 -> Constant a b -> Constant a a0 Source #
Functor (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods fmap :: (a0 -> b) -> Constant a a0 -> Constant a b Source # (<$) :: a0 -> Constant a b -> Constant a a0 Source #
Phantom (Constant a :: Type -> Type) Source # |
Instance details Defined in Lens.Family.Phantom Methods coerce :: Constant a a0 -> Constant a b
(Typeable b, Typeable k, Data a) => Data (Constant a b) |

Instance details

Defined in Data.Functor.Constant

Methods

gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Constant a b -> c (Constant a b) Source #

gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Constant a b) Source #

toConstr :: Constant a b -> Constr Source #

dataTypeOf :: Constant a b -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Constant a b)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Constant a b)) Source #

gmapT :: (forall b0. Data b0 => b0 -> b0) -> Constant a b -> Constant a b Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Constant a b -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Constant a b -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Constant a b -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Constant a b -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Constant a b -> m (Constant a b) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Constant a b -> m (Constant a b) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Constant a b -> m (Constant a b) Source #

Monoid a => Monoid (Constant a b) |
Instance details Defined in Data.Functor.Constant Methods mempty :: Constant a b Source # mappend :: Constant a b -> Constant a b -> Constant a b Source # mconcat :: [Constant a b] -> Constant a b Source #
Semigroup a => Semigroup (Constant a b) |
Instance details Defined in Data.Functor.Constant Methods (<>) :: Constant a b -> Constant a b -> Constant a b Source # sconcat :: NonEmpty (Constant a b) -> Constant a b Source # stimes :: Integral b0 => b0 -> Constant a b -> Constant a b Source #
Generic (Constant a b) |
Instance details Defined in Data.Functor.Constant Associated Types type Rep (Constant a b) :: Type -> Type Source # Methods from :: Constant a b -> Rep (Constant a b) x Source # to :: Rep (Constant a b) x -> Constant a b Source #
Read a => Read (Constant a b) |
Instance details Defined in Data.Functor.Constant Methods readsPrec :: Int -> ReadS (Constant a b) Source # readList :: ReadS [Constant a b] Source # readPrec :: ReadPrec (Constant a b) Source # readListPrec :: ReadPrec [Constant a b] Source #
Show a => Show (Constant a b) |
Instance details Defined in Data.Functor.Constant Methods showsPrec :: Int -> Constant a b -> ShowS Source # show :: Constant a b -> String Source # showList :: [Constant a b] -> ShowS Source #
Eq a => Eq (Constant a b) |
Instance details Defined in Data.Functor.Constant Methods (==) :: Constant a b -> Constant a b -> Bool Source # (/=) :: Constant a b -> Constant a b -> Bool Source #
Ord a => Ord (Constant a b) |

Instance details

Defined in Data.Functor.Constant

Methods

compare :: Constant a b -> Constant a b -> Ordering Source #

(<) :: Constant a b -> Constant a b -> Bool Source #

(<=) :: Constant a b -> Constant a b -> Bool Source #

(>) :: Constant a b -> Constant a b -> Bool Source #

(>=) :: Constant a b -> Constant a b -> Bool Source #

max :: Constant a b -> Constant a b -> Constant a b Source #

min :: Constant a b -> Constant a b -> Constant a b Source #

type Rep1 (Constant a :: k -> Type) |
Instance details Defined in Data.Functor.Constant type Rep1 (Constant a :: k -> Type) = D1 ('MetaData "Constant" "Data.Functor.Constant" "transformers-0.6.1.0" 'True) (C1 ('MetaCons "Constant" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConstant") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep (Constant a b) |
Instance details Defined in Data.Functor.Constant type Rep (Constant a b) = D1 ('MetaData "Constant" "Data.Functor.Constant" "transformers-0.6.1.0" 'True) (C1 ('MetaCons "Constant" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConstant") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

type ASetter s t a b = LensLike Identity s t a b Source #

type ASetter' s a = LensLike' Identity s a Source #

data Identity a Source #

Identity functor and monad. (a non-strict monad)

Since: base-4.8.0.0

#### Instances

Instances details

MonadFix Identity | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods mfix :: (a -> Identity a) -> Identity a Source #
Foldable Identity | Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

fold :: Monoid m => Identity m -> m Source #

foldMap :: Monoid m => (a -> m) -> Identity a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Identity a -> m Source #

foldr :: (a -> b -> b) -> b -> Identity a -> b Source #

foldr' :: (a -> b -> b) -> b -> Identity a -> b Source #

foldl :: (b -> a -> b) -> b -> Identity a -> b Source #

foldl' :: (b -> a -> b) -> b -> Identity a -> b Source #

foldr1 :: (a -> a -> a) -> Identity a -> a Source #

foldl1 :: (a -> a -> a) -> Identity a -> a Source #

toList :: Identity a -> [a] Source #

null :: Identity a -> Bool Source #

length :: Identity a -> Int Source #

elem :: Eq a => a -> Identity a -> Bool Source #

maximum :: Ord a => Identity a -> a Source #

minimum :: Ord a => Identity a -> a Source #

sum :: Num a => Identity a -> a Source #

product :: Num a => Identity a -> a Source #

Eq1 Identity | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftEq :: (a -> b -> Bool) -> Identity a -> Identity b -> Bool Source #
Ord1 Identity | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftCompare :: (a -> b -> Ordering) -> Identity a -> Identity b -> Ordering Source #
Read1 Identity | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Identity a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Identity a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a] Source #
Show1 Identity | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Identity a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Identity a] -> ShowS Source #
Traversable Identity | Since: base-4.9.0.0
Instance details Defined in Data.Traversable Methods traverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) Source # sequenceA :: Applicative f => Identity (f a) -> f (Identity a) Source # mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) Source # sequence :: Monad m => Identity (m a) -> m (Identity a) Source #
Applicative Identity | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods pure :: a -> Identity a Source # (<*>) :: Identity (a -> b) -> Identity a -> Identity b Source # liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c Source # (*>) :: Identity a -> Identity b -> Identity b Source # (<*) :: Identity a -> Identity b -> Identity a Source #
Functor Identity | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods fmap :: (a -> b) -> Identity a -> Identity b Source # (<$) :: a -> Identity b -> Identity a Source #
Monad Identity | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods (>>=) :: Identity a -> (a -> Identity b) -> Identity b Source # (>>) :: Identity a -> Identity b -> Identity b Source # return :: a -> Identity a Source #
NFData1 Identity | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods liftRnf :: (a -> ()) -> Identity a -> () Source #
Identical Identity Source # |
Instance details Defined in Lens.Family.Identical Methods extract :: Identity a -> a
Generic1 Identity |
Instance details Defined in Data.Functor.Identity Associated Types type Rep1 Identity :: k -> Type Source # Methods from1 :: forall (a :: k). Identity a -> Rep1 Identity a Source # to1 :: forall (a :: k). Rep1 Identity a -> Identity a Source #
Storable a => Storable (Identity a) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

sizeOf :: Identity a -> Int Source #

alignment :: Identity a -> Int Source #

peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) Source #

pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO (Identity a) Source #

pokeByteOff :: Ptr b -> Int -> Identity a -> IO () Source #

peek :: Ptr (Identity a) -> IO (Identity a) Source #

poke :: Ptr (Identity a) -> Identity a -> IO () Source #

Monoid a => Monoid (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods mempty :: Identity a Source # mappend :: Identity a -> Identity a -> Identity a Source # mconcat :: [Identity a] -> Identity a Source #
Semigroup a => Semigroup (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods (<>) :: Identity a -> Identity a -> Identity a Source # sconcat :: NonEmpty (Identity a) -> Identity a Source # stimes :: Integral b => b -> Identity a -> Identity a Source #
Bits a => Bits (Identity a) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(.&.) :: Identity a -> Identity a -> Identity a Source #

(.|.) :: Identity a -> Identity a -> Identity a Source #

xor :: Identity a -> Identity a -> Identity a Source #

complement :: Identity a -> Identity a Source #

shift :: Identity a -> Int -> Identity a Source #

rotate :: Identity a -> Int -> Identity a Source #

zeroBits :: Identity a Source #

bit :: Int -> Identity a Source #

setBit :: Identity a -> Int -> Identity a Source #

clearBit :: Identity a -> Int -> Identity a Source #

complementBit :: Identity a -> Int -> Identity a Source #

testBit :: Identity a -> Int -> Bool Source #

bitSizeMaybe :: Identity a -> Maybe Int Source #

bitSize :: Identity a -> Int Source #

isSigned :: Identity a -> Bool Source #

shiftL :: Identity a -> Int -> Identity a Source #

unsafeShiftL :: Identity a -> Int -> Identity a Source #

shiftR :: Identity a -> Int -> Identity a Source #

unsafeShiftR :: Identity a -> Int -> Identity a Source #

rotateL :: Identity a -> Int -> Identity a Source #

rotateR :: Identity a -> Int -> Identity a Source #

popCount :: Identity a -> Int Source #

FiniteBits a => FiniteBits (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods finiteBitSize :: Identity a -> Int Source # countLeadingZeros :: Identity a -> Int Source # countTrailingZeros :: Identity a -> Int Source #
Bounded a => Bounded (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods minBound :: Identity a Source # maxBound :: Identity a Source #
Enum a => Enum (Identity a) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

succ :: Identity a -> Identity a Source #

pred :: Identity a -> Identity a Source #

toEnum :: Int -> Identity a Source #

fromEnum :: Identity a -> Int Source #

enumFrom :: Identity a -> [Identity a] Source #

enumFromThen :: Identity a -> Identity a -> [Identity a] Source #

enumFromTo :: Identity a -> Identity a -> [Identity a] Source #

enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] Source #

Floating a => Floating (Identity a) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

pi :: Identity a Source #

exp :: Identity a -> Identity a Source #

log :: Identity a -> Identity a Source #

sqrt :: Identity a -> Identity a Source #

(**) :: Identity a -> Identity a -> Identity a Source #

logBase :: Identity a -> Identity a -> Identity a Source #

sin :: Identity a -> Identity a Source #

cos :: Identity a -> Identity a Source #

tan :: Identity a -> Identity a Source #

asin :: Identity a -> Identity a Source #

acos :: Identity a -> Identity a Source #

atan :: Identity a -> Identity a Source #

sinh :: Identity a -> Identity a Source #

cosh :: Identity a -> Identity a Source #

tanh :: Identity a -> Identity a Source #

asinh :: Identity a -> Identity a Source #

acosh :: Identity a -> Identity a Source #

atanh :: Identity a -> Identity a Source #

log1p :: Identity a -> Identity a Source #

expm1 :: Identity a -> Identity a Source #

log1pexp :: Identity a -> Identity a Source #

log1mexp :: Identity a -> Identity a Source #

RealFloat a => RealFloat (Identity a) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

floatRadix :: Identity a -> Integer Source #

floatDigits :: Identity a -> Int Source #

floatRange :: Identity a -> (Int, Int) Source #

decodeFloat :: Identity a -> (Integer, Int) Source #

encodeFloat :: Integer -> Int -> Identity a Source #

exponent :: Identity a -> Int Source #

significand :: Identity a -> Identity a Source #

scaleFloat :: Int -> Identity a -> Identity a Source #

isNaN :: Identity a -> Bool Source #

isInfinite :: Identity a -> Bool Source #

isDenormalized :: Identity a -> Bool Source #

isNegativeZero :: Identity a -> Bool Source #

isIEEE :: Identity a -> Bool Source #

atan2 :: Identity a -> Identity a -> Identity a Source #

Generic (Identity a) |
Instance details Defined in Data.Functor.Identity Associated Types type Rep (Identity a) :: Type -> Type Source # Methods from :: Identity a -> Rep (Identity a) x Source # to :: Rep (Identity a) x -> Identity a Source #
Ix a => Ix (Identity a) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

range :: (Identity a, Identity a) -> [Identity a] Source #

index :: (Identity a, Identity a) -> Identity a -> Int Source #

unsafeIndex :: (Identity a, Identity a) -> Identity a -> Int Source #

inRange :: (Identity a, Identity a) -> Identity a -> Bool Source #

rangeSize :: (Identity a, Identity a) -> Int Source #

unsafeRangeSize :: (Identity a, Identity a) -> Int Source #

Num a => Num (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods (+) :: Identity a -> Identity a -> Identity a Source # (-) :: Identity a -> Identity a -> Identity a Source # (*) :: Identity a -> Identity a -> Identity a Source # negate :: Identity a -> Identity a Source # abs :: Identity a -> Identity a Source # signum :: Identity a -> Identity a Source # fromInteger :: Integer -> Identity a Source #
Read a => Read (Identity a) | This instance would be equivalent to the derived instances of the `Identity` newtype if the `runIdentity` field were removed Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods readsPrec :: Int -> ReadS (Identity a) Source # readList :: ReadS [Identity a] Source # readPrec :: ReadPrec (Identity a) Source # readListPrec :: ReadPrec [Identity a] Source #
Fractional a => Fractional (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods (/) :: Identity a -> Identity a -> Identity a Source # recip :: Identity a -> Identity a Source # fromRational :: Rational -> Identity a Source #
Integral a => Integral (Identity a) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

quot :: Identity a -> Identity a -> Identity a Source #

rem :: Identity a -> Identity a -> Identity a Source #

div :: Identity a -> Identity a -> Identity a Source #

mod :: Identity a -> Identity a -> Identity a Source #

quotRem :: Identity a -> Identity a -> (Identity a, Identity a) Source #

divMod :: Identity a -> Identity a -> (Identity a, Identity a) Source #

toInteger :: Identity a -> Integer Source #

Real a => Real (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods toRational :: Identity a -> Rational Source #
RealFrac a => RealFrac (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods properFraction :: Integral b => Identity a -> (b, Identity a) Source # truncate :: Integral b => Identity a -> b Source # round :: Integral b => Identity a -> b Source # ceiling :: Integral b => Identity a -> b Source # floor :: Integral b => Identity a -> b Source #
Show a => Show (Identity a) | This instance would be equivalent to the derived instances of the `Identity` newtype if the `runIdentity` field were removed Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods showsPrec :: Int -> Identity a -> ShowS Source # show :: Identity a -> String Source # showList :: [Identity a] -> ShowS Source #
NFData a => NFData (Identity a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Identity a -> () Source #
Eq a => Eq (Identity a) | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods (==) :: Identity a -> Identity a -> Bool Source # (/=) :: Identity a -> Identity a -> Bool Source #
Ord a => Ord (Identity a) | Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

compare :: Identity a -> Identity a -> Ordering Source #

(<) :: Identity a -> Identity a -> Bool Source #

(<=) :: Identity a -> Identity a -> Bool Source #

(>) :: Identity a -> Identity a -> Bool Source #

(>=) :: Identity a -> Identity a -> Bool Source #

max :: Identity a -> Identity a -> Identity a Source #

min :: Identity a -> Identity a -> Identity a Source #

type Rep1 Identity | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity type Rep1 Identity = D1 ('MetaData "Identity" "Data.Functor.Identity" "base" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep (Identity a) | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity type Rep (Identity a) = D1 ('MetaData "Identity" "Data.Functor.Identity" "base" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

data StateT s (m :: Type -> Type) a Source #

A state transformer monad parameterized by:

- `s` - The state.
- `m` - The inner monad.

The `return` function leaves the state unchanged, while `>>=` uses the final state of the first computation as the initial state of the second.

#### Instances

Instances details

MonadTrans (StateT s) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods lift :: Monad m => m a -> StateT s m a Source #
MonadFail m => MonadFail (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods fail :: String -> StateT s m a Source #
MonadFix m => MonadFix (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods mfix :: (a -> StateT s m a) -> StateT s m a Source #
MonadIO m => MonadIO (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods liftIO :: IO a -> StateT s m a Source #
Contravariant m => Contravariant (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods contramap :: (a' -> a) -> StateT s m a -> StateT s m a' Source # (>$) :: b -> StateT s m b -> StateT s m a Source #
(Functor m, MonadPlus m) => Alternative (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods empty :: StateT s m a Source # (<|>) :: StateT s m a -> StateT s m a -> StateT s m a Source # some :: StateT s m a -> StateT s m [a] Source # many :: StateT s m a -> StateT s m [a] Source #
(Functor m, Monad m) => Applicative (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods pure :: a -> StateT s m a Source # (<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b Source # liftA2 :: (a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c Source # (*>) :: StateT s m a -> StateT s m b -> StateT s m b Source # (<*) :: StateT s m a -> StateT s m b -> StateT s m a Source #
Functor m => Functor (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods fmap :: (a -> b) -> StateT s m a -> StateT s m b Source # (<$) :: a -> StateT s m b -> StateT s m a Source #
Monad m => Monad (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods (>>=) :: StateT s m a -> (a -> StateT s m b) -> StateT s m b Source # (>>) :: StateT s m a -> StateT s m b -> StateT s m b Source # return :: a -> StateT s m a Source #
MonadPlus m => MonadPlus (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods mzero :: StateT s m a Source # mplus :: StateT s m a -> StateT s m a -> StateT s m a Source #
Generic (StateT s m a) |
Instance details Defined in Control.Monad.Trans.State.Lazy Associated Types type Rep (StateT s m a) :: Type -> Type Source # Methods from :: StateT s m a -> Rep (StateT s m a) x Source # to :: Rep (StateT s m a) x -> StateT s m a Source #
type Rep (StateT s m a) |
Instance details Defined in Control.Monad.Trans.State.Lazy type Rep (StateT s m a) = D1 ('MetaData "StateT" "Control.Monad.Trans.State.Lazy" "transformers-0.6.1.0" 'True) (C1 ('MetaCons "StateT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runStateT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (s -> m (a, s)))))

type Writer w = WriterT w Identity Source #

A writer monad parameterized by the type `w` of output to accumulate.

The `return` function produces the output `mempty`, while `>>=` combines the outputs of the subcomputations using `mappend`.