Safe Haskell | Safe-Infered |
---|

- focus :: Monad m => Lens a b -> StateT b m c -> StateT a m c
- access :: MonadState a m => Getter a b -> m b
- (%=) :: MonadState a m => Setter a b -> (b -> b) -> m ()
- (~=) :: MonadState a m => Setter a b -> b -> m ()
- (%%=) :: MonadState a m => Lens a b -> (b -> (c, b)) -> m c
- (+=), (*=), (-=) :: (MonadState a m, Num b) => Setter a b -> b -> m ()
- (//=) :: (MonadState a m, Fractional b) => Setter a b -> b -> m ()
- (&&=), (||=) :: MonadState a m => Setter a Bool -> Bool -> m ()
- (<>=) :: (Monoid o, MonadState a m) => Setter a o -> o -> m ()

# Documentation

focus :: Monad m => Lens a b -> StateT b m c -> StateT a m cSource

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.

access :: MonadState a m => Getter a b -> m bSource

Retrieve a field of the state

(%=) :: MonadState a m => Setter a b -> (b -> b) -> m ()Source

Modify a field of the state

(~=) :: MonadState a m => Setter a b -> b -> m ()Source

Set a field of the state

(%%=) :: MonadState a m => Lens a b -> (b -> (c, b)) -> m cSource

Modify a field of the state while returning another value

# Compound Assignments

(//=) :: (MonadState a m, Fractional b) => Setter a b -> b -> m ()Source