fclabels-1.0: First class accessor labels.

Data.Label.PureM

Contents

Synopsis

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.

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.