fclabels-1.1.4.3: First class accessor labels.

Safe Haskell | Safe-Inferred

Data.Label.PureM

Contents

- `MonadState` lens operations.
- `MonadReader` lens operations.

Synopsis

- gets :: MonadState s m => (s :-> a) -> m a
- puts :: MonadState s m => (s :-> a) -> a -> m ()
- modify :: MonadState s m => (s :-> a) -> (a -> a) -> m ()
- (=:) :: MonadState s m => (s :-> a) -> a -> m ()
- (=.) :: MonadState s m => (s :-> a) -> (a -> a) -> m ()
- asks :: MonadReader r m => (r :-> a) -> m a
- local :: MonadReader r m => (r :-> b) -> (b -> b) -> m a -> m a

# `MonadState` lens operations.

gets :: MonadState s m => (s :-> a) -> m aSource

Get a value out of the state, pointed to by the specified lens.

puts :: MonadState s m => (s :-> a) -> a -> m ()Source

Set a value somewhere in the state, pointed to by the specified lens.

modify :: MonadState s m => (s :-> a) -> (a -> a) -> m ()Source

Modify a value with a function somewhere in the state, pointed to by the specified lens.

(=:) :: MonadState s m => (s :-> a) -> a -> m ()Source

Alias for `puts` that reads like an assignment.

(=.) :: MonadState s m => (s :-> a) -> (a -> a) -> m ()Source

Alias for `modify` that reads more or less like an assignment.

# `MonadReader` lens operations.

asks :: MonadReader r m => (r :-> a) -> m aSource

Fetch a value pointed to by a lens out of a reader environment.

local :: MonadReader r m => (r :-> b) -> (b -> b) -> m a -> m aSource

Execute a computation in a modified environment. The lens is used to point out the part to modify.