fclabels-0.11.1: First class accessor labels implemented as lenses.

Data.Record.Label.Monadic

Contents

Synopsis

Monadic lens operations.

getM :: MonadState s m => (s :-> b) -> m bSource

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

setM :: MonadState s m => (s :-> b) -> b -> m ()Source

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

modM :: MonadState s m => (s :-> b) -> (b -> b) -> m ()Source

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

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

Alias for setM that reads like an assignment.

askM :: MonadReader r m => (r :-> b) -> m bSource

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

localM :: 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.