lens-family-core-1.2.3: Haskell 98 Lens Families

Safe Haskell | Safe
Language | Haskell98

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

# Documentation

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

    zoom :: Monad m => Lens' a b -> StateT b m c -> StateT a 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 :: (Monoid c, Monad m) => Traversal' a b -> StateT b m c -> StateT a m c

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

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

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

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

    use :: Monad m => Getter a a' b b' -> StateT a m b

Retrieve a field of the state

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

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

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

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

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

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

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

    uses l f = f <$> use l

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

Modify a field of the state.

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

Set a field of the state.

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

Set a field of the state.

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

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

Modify a field of the state while returning another value.

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

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

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

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

# Compound Assignments

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

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

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

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

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

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

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

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

# Strict Assignments

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

Strictly modify a field of the state.

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

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

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

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

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

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

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

# Types

data Zooming m c a Source #

Instances

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 #
(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 #

# Re-exports

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

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

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

data Constant a (b :: k) :: forall k. Type -> k -> Type Source #

Constant functor.

Instances

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 #
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 #
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 #
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 #
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 #
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 #

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 #

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 #
Contravariant (Constant a :: Type -> Type) |
Instance details Defined in Data.Functor.Constant Methods contramap :: (a0 -> b) -> Constant a b -> Constant a a0 Source # (>$) :: b -> Constant a b -> Constant a 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 #
Phantom (Constant a :: Type -> Type) Source # |
Instance details Defined in Lens.Family.Phantom Methods coerce :: Constant a a0 -> Constant a b
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 #

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 #
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 #
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 #

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

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

data Identity a Source #

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

Since: base-4.8.0.0

Instances

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 # fail :: String -> 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 #
MonadFix Identity | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods mfix :: (a -> Identity a) -> 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 #
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 #

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 #

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 #
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 #
Identical Identity Source # |
Instance details Defined in Lens.Family.Identical Methods extract :: Identity a -> a
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 #

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 #
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 #

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 #

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 #
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 #

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 #
Real a => Real (Identity a) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Identity Methods toRational :: Identity a -> Rational 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 #

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 #
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

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

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

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

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 #
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 #
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 #
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 #

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 #
Generic1 Identity |
Instance details Defined in Data.Functor.Identity Associated Types type Rep1 Identity :: k -> Type Source # Methods from1 :: Identity a -> Rep1 Identity a Source # to1 :: Rep1 Identity a -> Identity a Source #
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)))
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))

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

MonadTrans (StateT s) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods lift :: Monad m => m a -> 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 # fail :: String -> 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 #
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 #
MonadFail m => MonadFail (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods fail :: String -> 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 #
Contravariant m => Contravariant (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods contramap :: (a -> b) -> StateT s m b -> StateT s m a Source # (>$) :: b -> StateT s m b -> 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 #
(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 #
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 #

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`.

class Semigroup a => Monoid a Source #

The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:

-     x <> mempty = x

-     mempty <> x = x

- `x `<>` (y `<>` z) = (x `<>` y) `<>` z` (`Semigroup` law)

-     mconcat = foldr '(<>)' mempty

The method names refer to the monoid of lists under concatenation, but there are many other instances.

Some types can be viewed as a monoid in more than one way, e.g. both addition and multiplication on numbers. In such cases we often define `newtype`s and make those instances of `Monoid`, e.g. `Sum` and `Product`.

NOTE: `Semigroup` is a superclass of `Monoid` since base-4.11.0.0.

Minimal complete definition

mempty

Instances

Monoid Ordering | Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: Ordering Source # mappend :: Ordering -> Ordering -> Ordering Source # mconcat :: [Ordering] -> Ordering Source #
Monoid () | Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: () Source # mappend :: () -> () -> () Source # mconcat :: [()] -> () Source #
Monoid All | Since: base-2.1
Instance details Defined in Data.Semigroup.Internal Methods mempty :: All Source # mappend :: All -> All -> All Source # mconcat :: [All] -> All Source #
Monoid Any | Since: base-2.1
Instance details Defined in Data.Semigroup.Internal Methods mempty :: Any Source # mappend :: Any -> Any -> Any Source # mconcat :: [Any] -> Any Source #
Monoid IntSet |
Instance details Defined in Data.IntSet.Internal Methods mempty :: IntSet Source # mappend :: IntSet -> IntSet -> IntSet Source # mconcat :: [IntSet] -> IntSet Source #
Monoid [a] | Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: [a] Source # mappend :: [a] -> [a] -> [a] Source # mconcat :: [[a]] -> [a] Source #
Semigroup a => Monoid (Maybe a) | Lift a semigroup into `Maybe` forming a `Monoid` according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup `S` may be turned into a monoid simply by adjoining an element `e` not in `S` and defining `e*e = e` and `e*s = s = s*e` for all `s ∈ S`." Since 4.11.0: constraint on inner `a` value generalised from `Monoid` to `Semigroup`. Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: Maybe a Source # mappend :: Maybe a -> Maybe a -> Maybe a Source # mconcat :: [Maybe a] -> Maybe a Source #
Monoid a => Monoid (IO a) | Since: base-4.9.0.0
Instance details Defined in GHC.Base Methods mempty :: IO a Source # mappend :: IO a -> IO a -> IO a Source # mconcat :: [IO a] -> IO a Source #
Monoid p => Monoid (Par1 p) | Since: base-4.12.0.0
Instance details Defined in GHC.Generics Methods mempty :: Par1 p Source # mappend :: Par1 p -> Par1 p -> Par1 p Source # mconcat :: [Par1 p] -> Par1 p 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 #
Monoid (First a) | Since: base-2.1
Instance details Defined in Data.Monoid Methods mempty :: First a Source # mappend :: First a -> First a -> First a Source # mconcat :: [First a] -> First a Source #
Monoid (Last a) | Since: base-2.1
Instance details Defined in Data.Monoid Methods mempty :: Last a Source # mappend :: Last a -> Last a -> Last a Source # mconcat :: [Last a] -> Last a Source #
Monoid a => Monoid (Dual a) | Since: base-2.1
Instance details Defined in Data.Semigroup.Internal Methods mempty :: Dual a Source # mappend :: Dual a -> Dual a -> Dual a Source # mconcat :: [Dual a] -> Dual a Source #
Monoid (Endo a) | Since: base-2.1
Instance details Defined in Data.Semigroup.Internal Methods mempty :: Endo a Source # mappend :: Endo a -> Endo a -> Endo a Source # mconcat :: [Endo a] -> Endo a Source #
Num a => Monoid (Sum a) | Since: base-2.1
Instance details Defined in Data.Semigroup.Internal Methods mempty :: Sum a Source # mappend :: Sum a -> Sum a -> Sum a Source # mconcat :: [Sum a] -> Sum a Source #
Num a => Monoid (Product a) | Since: base-2.1
Instance details Defined in Data.Semigroup.Internal Methods mempty :: Product a Source # mappend :: Product a -> Product a -> Product a Source # mconcat :: [Product a] -> Product a Source #
Monoid a => Monoid (Down a) | Since: base-4.11.0.0
Instance details Defined in Data.Ord Methods mempty :: Down a Source # mappend :: Down a -> Down a -> Down a Source # mconcat :: [Down a] -> Down a Source #
Monoid (IntMap a) |
Instance details Defined in Data.IntMap.Internal Methods mempty :: IntMap a Source # mappend :: IntMap a -> IntMap a -> IntMap a Source # mconcat :: [IntMap a] -> IntMap a Source #
Ord a => Monoid (Set a) |
Instance details Defined in Data.Set.Internal Methods mempty :: Set a Source # mappend :: Set a -> Set a -> Set a Source # mconcat :: [Set a] -> Set a Source #
Monoid (MergeSet a) |
Instance details Defined in Data.Set.Internal Methods mempty :: MergeSet a Source # mappend :: MergeSet a -> MergeSet a -> MergeSet a Source # mconcat :: [MergeSet a] -> MergeSet a Source #
Monoid b => Monoid (a -> b) | Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: a -> b Source # mappend :: (a -> b) -> (a -> b) -> a -> b Source # mconcat :: [a -> b] -> a -> b Source #
Monoid (U1 p) | Since: base-4.12.0.0
Instance details Defined in GHC.Generics Methods mempty :: U1 p Source # mappend :: U1 p -> U1 p -> U1 p Source # mconcat :: [U1 p] -> U1 p Source #
(Monoid a, Monoid b) => Monoid (a, b) | Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: (a, b) Source # mappend :: (a, b) -> (a, b) -> (a, b) Source # mconcat :: [(a, b)] -> (a, b) Source #
Monoid (Proxy s) | Since: base-4.7.0.0
Instance details Defined in Data.Proxy Methods mempty :: Proxy s Source # mappend :: Proxy s -> Proxy s -> Proxy s Source # mconcat :: [Proxy s] -> Proxy s Source #
Ord k => Monoid (Map k v) |
Instance details Defined in Data.Map.Internal Methods mempty :: Map k v Source # mappend :: Map k v -> Map k v -> Map k v Source # mconcat :: [Map k v] -> Map k v Source #
Monoid (f p) => Monoid (Rec1 f p) | Since: base-4.12.0.0
Instance details Defined in GHC.Generics Methods mempty :: Rec1 f p Source # mappend :: Rec1 f p -> Rec1 f p -> Rec1 f p Source # mconcat :: [Rec1 f p] -> Rec1 f p Source #
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: (a, b, c) Source # mappend :: (a, b, c) -> (a, b, c) -> (a, b, c) Source # mconcat :: [(a, b, c)] -> (a, b, c) Source #
Monoid a => Monoid (Const a b) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Const Methods mempty :: Const a b Source # mappend :: Const a b -> Const a b -> Const a b Source # mconcat :: [Const a b] -> Const a b Source #
(Applicative f, Monoid a) => Monoid (Ap f a) | Since: base-4.12.0.0
Instance details Defined in Data.Monoid Methods mempty :: Ap f a Source # mappend :: Ap f a -> Ap f a -> Ap f a Source # mconcat :: [Ap f a] -> Ap f a Source #
Alternative f => Monoid (Alt f a) | Since: base-4.8.0.0
Instance details Defined in Data.Semigroup.Internal Methods mempty :: Alt f a Source # mappend :: Alt f a -> Alt f a -> Alt f a Source # mconcat :: [Alt f a] -> Alt f a 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 #
Monoid c => Monoid (K1 i c p) | Since: base-4.12.0.0
Instance details Defined in GHC.Generics Methods mempty :: K1 i c p Source # mappend :: K1 i c p -> K1 i c p -> K1 i c p Source # mconcat :: [K1 i c p] -> K1 i c p Source #
(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) | Since: base-4.12.0.0
Instance details Defined in GHC.Generics Methods mempty :: (f :*: g) p Source # mappend :: (f :*: g) p -> (f :*: g) p -> (f :*: g) p Source # mconcat :: [(f :*: g) p] -> (f :*: g) p Source #
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: (a, b, c, d) Source # mappend :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source # mconcat :: [(a, b, c, d)] -> (a, b, c, d) Source #
Monoid (f p) => Monoid (M1 i c f p) | Since: base-4.12.0.0
Instance details Defined in GHC.Generics Methods mempty :: M1 i c f p Source # mappend :: M1 i c f p -> M1 i c f p -> M1 i c f p Source # mconcat :: [M1 i c f p] -> M1 i c f p Source #
Monoid (f (g p)) => Monoid ((f :.: g) p) | Since: base-4.12.0.0
Instance details Defined in GHC.Generics Methods mempty :: (f :.: g) p Source # mappend :: (f :.: g) p -> (f :.: g) p -> (f :.: g) p Source # mconcat :: [(f :.: g) p] -> (f :.: g) p Source #
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | Since: base-2.1
Instance details Defined in GHC.Base Methods mempty :: (a, b, c, d, e) Source # mappend :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source # mconcat :: [(a, b, c, d, e)] -> (a, b, c, d, e) Source #