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

Safe HaskellSafe
LanguageHaskell98

Data.Label.Monadic

Contents

Description

State and Reader operations specialized for working with total lenses.

Synopsis

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.