| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Lens.Family2.State.Lazy
Description
Synopsis
- zoom :: forall (m :: Type -> Type) c s a. Monad m => LensLike' (Zooming m c) s a -> StateT a m c -> StateT s m c
- use :: MonadState s m => FoldLike a s t a b -> m a
- uses :: MonadState s m => FoldLike r s t a b -> (a -> r) -> m r
- (%=) :: MonadState s m => Setter s s a b -> (a -> b) -> m ()
- assign :: MonadState s m => Setter s s a b -> b -> m ()
- (.=) :: MonadState s m => Setter s s a b -> b -> m ()
- (%%=) :: MonadState s m => LensLike (Writer c) s s a b -> (a -> (c, b)) -> m c
- (<~) :: MonadState s m => Setter s s a b -> m b -> m ()
- (+=) :: (MonadState s m, Num a) => Setter' s a -> a -> m ()
- (-=) :: (MonadState s m, Num a) => Setter' s a -> a -> m ()
- (*=) :: (MonadState s m, Num a) => Setter' s a -> a -> m ()
- (//=) :: (MonadState s m, Fractional a) => Setter' s a -> a -> m ()
- (&&=) :: MonadState s m => Setter' s Bool -> Bool -> m ()
- (||=) :: MonadState s m => Setter' s Bool -> Bool -> m ()
- (<>=) :: (MonadState s m, Monoid a) => Setter' s a -> a -> m ()
- (%!=) :: MonadState s m => Setter s s a b -> (a -> b) -> m ()
- (+!=) :: (MonadState s m, Num a) => Setter' s a -> a -> m ()
- (-!=) :: (MonadState s m, Num a) => Setter' s a -> a -> m ()
- (*!=) :: (MonadState s m, Num a) => Setter' s a -> a -> m ()
- (//!=) :: (MonadState s m, Fractional a) => Setter' s a -> a -> m ()
- (&&!=) :: MonadState s m => Setter' s Bool -> Bool -> m ()
- (||!=) :: MonadState s m => Setter' s Bool -> Bool -> m ()
- (<>!=) :: (MonadState s m, Monoid a) => Setter' s a -> a -> m ()
- data Zooming (m :: Type -> Type) c a
- type LensLike (f :: Type -> Type) s t a b = (a -> f b) -> s -> f t
- type LensLike' (f :: Type -> Type) s a = (a -> f a) -> s -> f s
- type FoldLike r s t a b = LensLike (Constant r :: Type -> Type) s t a b
- data Constant a (b :: k)
- type Setter s t a b = forall f. Identical f => LensLike f s t a b
- type Setter' s a = forall f. Identical f => LensLike' f s a
- class (Traversable f, Applicative f) => Identical (f :: Type -> Type)
- data StateT s (m :: Type -> Type) a
- class Monad m => MonadState s (m :: Type -> Type) | m -> s
- type Writer w = WriterT w Identity
Documentation
zoom :: forall (m :: Type -> Type) c s a. Monad m => LensLike' (Zooming m c) s a -> StateT a m c -> StateT s m c #
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 :: MonadState s m => FoldLike a s t a b -> m a Source #
use :: MonadState s m => Getter s t a b -> m a
Retrieve a field of the state
use :: (MonadState s m, Monoid a) => Fold s t a b -> m a
Retrieve a monoidal summary of all the referenced fields from the state
uses :: MonadState s m => FoldLike r s t a b -> (a -> r) -> m r Source #
uses :: (MonadState s m, Monoid r) => Fold s t a b -> (a -> r) -> m r
Retrieve all the referenced fields from the state and foldMap the results together with f :: a -> r.
uses :: MonadState s m => Getter s t a b -> (a -> r) -> m r
Retrieve a field of the state and pass it through the function f :: a -> r.
uses l f = f <$> use l
(%=) :: MonadState s m => Setter s s a b -> (a -> b) -> m () infix 4 Source #
Modify a field of the state.
assign :: MonadState s m => Setter s s a b -> b -> m () Source #
Set a field of the state.
(.=) :: MonadState s m => Setter s s a b -> b -> m () infix 4 Source #
Set a field of the state.
(%%=) :: MonadState s m => LensLike (Writer c) s s a b -> (a -> (c, b)) -> m c infix 4 Source #
(%%=) :: MonadState s m => Lens s s a b -> (a -> (c, b)) -> m c
Modify a field of the state while returning another value.
(%%=) :: (MonadState s m, Monoid c) => Traversal s s a b -> (a -> (c, b)) -> m c
Modify each field of the state and return the mconcat of the other values.
(<~) :: MonadState s m => Setter s s a b -> m b -> m () infixr 2 Source #
Set a field of the state using the result of executing a stateful command.
Compound Assignments
(//=) :: (MonadState s m, Fractional a) => Setter' s a -> a -> m () infixr 4 Source #
(<>=) :: (MonadState s m, Monoid a) => Setter' s a -> a -> m () infixr 4 Source #
Monoidally append a value to all referenced fields of the state.
Strict Assignments
(%!=) :: MonadState s m => Setter s s a b -> (a -> b) -> m () infix 4 Source #
Strictly modify a field of the state.
(//!=) :: (MonadState s m, Fractional a) => Setter' s a -> a -> m () infixr 4 Source #
Types
data Zooming (m :: Type -> Type) c a #
Instances
| (Monoid c, Monad m) => Applicative (Zooming m c) | |
Defined in Lens.Family.State.Zoom | |
| Monad m => Functor (Zooming m c) | |
Re-exports
Constant functor.
Instances
| Generic1 (Constant a :: k -> Type) | |
| Bifoldable (Constant :: Type -> Type -> Type) | |
| Bifunctor (Constant :: Type -> Type -> Type) | |
| Bitraversable (Constant :: Type -> Type -> Type) | |
Defined in Data.Functor.Constant Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Constant a b -> f (Constant c d) # | |
| Eq2 (Constant :: Type -> Type -> Type) | |
| Ord2 (Constant :: Type -> Type -> Type) | |
Defined in Data.Functor.Constant | |
| Read2 (Constant :: Type -> Type -> Type) | |
Defined in Data.Functor.Constant Methods liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Constant a b) # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Constant a b] # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Constant a b) # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Constant a b] # | |
| Show2 (Constant :: Type -> Type -> Type) | |
| Foldable (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant Methods fold :: Monoid m => Constant a m -> m # foldMap :: Monoid m => (a0 -> m) -> Constant a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Constant a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Constant a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Constant a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Constant a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Constant a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 # toList :: Constant a a0 -> [a0] # null :: Constant a a0 -> Bool # length :: Constant a a0 -> Int # elem :: Eq a0 => a0 -> Constant a a0 -> Bool # maximum :: Ord a0 => Constant a a0 -> a0 # minimum :: Ord a0 => Constant a a0 -> a0 # | |
| Eq a => Eq1 (Constant a :: Type -> Type) | |
| Ord a => Ord1 (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant | |
| Read a => Read1 (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant Methods liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Constant a a0) # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Constant a a0] # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Constant a a0) # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Constant a a0] # | |
| Show a => Show1 (Constant a :: Type -> Type) | |
| Contravariant (Constant a :: Type -> Type) | |
| Traversable (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant | |
| Monoid a => Applicative (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant | |
| Functor (Constant a :: Type -> Type) | |
| Phantom (Constant a :: Type -> Type) | |
Defined in Lens.Family.Phantom | |
| (Typeable b, Typeable k, Data a) => Data (Constant a b) | |
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) # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Constant a b) # toConstr :: Constant a b -> Constr # dataTypeOf :: Constant a b -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Constant a b)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Constant a b)) # gmapT :: (forall b0. Data b0 => b0 -> b0) -> Constant a b -> Constant a b # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Constant a b -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Constant a b -> r # gmapQ :: (forall d. Data d => d -> u) -> Constant a b -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Constant a b -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Constant a b -> m (Constant a b) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Constant a b -> m (Constant a b) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Constant a b -> m (Constant a b) # | |
| Monoid a => Monoid (Constant a b) | |
| Semigroup a => Semigroup (Constant a b) | |
| Generic (Constant a b) | |
| Read a => Read (Constant a b) | |
| Show a => Show (Constant a b) | |
| Eq a => Eq (Constant a b) | |
| Ord a => Ord (Constant a b) | |
Defined in Data.Functor.Constant | |
| type Rep1 (Constant a :: k -> Type) | |
Defined in Data.Functor.Constant | |
| type Rep (Constant a b) | |
Defined in Data.Functor.Constant | |
class (Traversable f, Applicative f) => Identical (f :: Type -> Type) #
Minimal complete definition
extract
Instances
| Identical Identity | |
Defined in Lens.Family.Identical | |
| Identical f => Identical (Backwards f) | |
Defined in Lens.Family.Identical | |
| (Identical f, Identical g) => Identical (Compose f g) | |
Defined in Lens.Family.Identical | |
data StateT s (m :: Type -> Type) a #
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
| Monad m => MonadState s (StateT s m) | |
| MonadTrans (StateT s) | |
Defined in Control.Monad.Trans.State.Lazy | |
| MonadFail m => MonadFail (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy | |
| MonadFix m => MonadFix (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy | |
| MonadIO m => MonadIO (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy | |
| Contravariant m => Contravariant (StateT s m) | |
| (Functor m, MonadPlus m) => Alternative (StateT s m) | |
| (Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy | |
| Functor m => Functor (StateT s m) | |
| Monad m => Monad (StateT s m) | |
| MonadPlus m => MonadPlus (StateT s m) | |
| Generic (StateT s m a) | |
| type Rep (StateT s m a) | |
Defined in Control.Monad.Trans.State.Lazy | |
class Monad m => MonadState s (m :: Type -> Type) | m -> s #
Minimal definition is either both of get and put or just state
Instances
| MonadState s m => MonadState s (MaybeT m) | |
| (Monoid w, MonadState s m) => MonadState s (AccumT w m) | Since: mtl-2.3 |
| MonadState s m => MonadState s (ExceptT e m) | Since: mtl-2.2 |
| MonadState s m => MonadState s (IdentityT m) | |
| MonadState s m => MonadState s (ReaderT r m) | |
| MonadState s m => MonadState s (SelectT r m) | Since: mtl-2.3 |
| Monad m => MonadState s (StateT s m) | |
| Monad m => MonadState s (StateT s m) | |
| (Monoid w, MonadState s m) => MonadState s (WriterT w m) | Since: mtl-2.3 |
| (Monoid w, MonadState s m) => MonadState s (WriterT w m) | |
| (Monoid w, MonadState s m) => MonadState s (WriterT w m) | |
| MonadState s m => MonadState s (ContT r m) | |
| (Monad m, Monoid w) => MonadState s (RWST r w s m) | Since: mtl-2.3 |
| (Monad m, Monoid w) => MonadState s (RWST r w s m) | |
| (Monad m, Monoid w) => MonadState s (RWST r w s m) | |