Safe Haskell | Safe |
---|---|
Language | Haskell98 |
State and Reader operations specialized for working with total lenses.
Synopsis
- gets :: MonadState f m => Lens (->) f o -> m o
- puts :: MonadState f m => Lens (->) f o -> o -> m ()
- modify :: MonadState f m => Lens (->) f o -> (o -> o) -> m ()
- modifyAndGet :: MonadState f m => Lens (->) f o -> (o -> (a, o)) -> m a
- (=:) :: MonadState f m => Lens (->) f o -> o -> m ()
- (=.) :: MonadState f m => Lens (->) f o -> (o -> o) -> m ()
- asks :: MonadReader f m => Lens (->) f o -> m o
- local :: MonadReader f m => Lens (->) f o -> (o -> o) -> m a -> m a
MonadState
lens operations.
gets :: MonadState f m => Lens (->) f o -> m o Source #
Get a value out of the state, pointed to by the specified lens.
puts :: MonadState f m => Lens (->) f o -> o -> m () Source #
Set a value somewhere in the state, pointed to by the specified lens.
modify :: MonadState f m => Lens (->) f o -> (o -> o) -> m () Source #
Modify a value with a function somewhere in the state, pointed to by the specified lens.
modifyAndGet :: MonadState f m => Lens (->) f o -> (o -> (a, o)) -> m a Source #
Modify a value with a function somewhere in the state, pointed to by the specified lens. Additionally return a separate value based on the modification.
(=:) :: MonadState f m => Lens (->) f o -> o -> m () infixr 2 Source #
Alias for puts
that reads like an assignment.
(=.) :: MonadState f m => Lens (->) f o -> (o -> o) -> m () infixr 2 Source #
Alias for modify
that reads more or less like an assignment.
MonadReader
lens operations.
asks :: MonadReader f m => Lens (->) f o -> m o Source #
Fetch a value pointed to by a lens out of a reader environment.
local :: MonadReader f m => Lens (->) f o -> (o -> o) -> m a -> m a Source #
Execute a computation in a modified environment. The lens is used to point out the part to modify.