fused-effects-lens-0.2.0.0: Monadic lens combinators for fused-effects.

Safe HaskellNone
LanguageHaskell2010

Control.Effect.Lens

Description

Provides combinators for the lens-based manipulation of state and context types provided by the fused-effects library, similar to those provided for mtl-based monad transformers.

Synopsis
  • view :: forall r a sig m. (Member (Reader r) sig, Carrier sig m, Functor m) => Getting a r a -> m a
  • views :: forall s a b sig m. (Member (Reader s) sig, Carrier sig m, Functor m) => Getting a s a -> (a -> b) -> m b
  • use :: forall s a sig m. (Member (State s) sig, Carrier sig m, Monad m) => Getting a s a -> m a
  • uses :: forall s a b f sig. (Carrier sig f, Functor f, Member (State s) sig) => Getting a s a -> (a -> b) -> f b
  • assign :: forall s a b sig m. (Member (State s) sig, Carrier sig m, Monad m) => ASetter s s a b -> b -> m ()
  • (.=) :: forall s a b sig m. (Member (State s) sig, Carrier sig m, Monad m) => ASetter s s a b -> b -> m ()
  • modifying :: forall s a b sig m. (Member (State s) sig, Carrier sig m, Monad m) => ASetter s s a b -> (a -> b) -> m ()
  • (%=) :: forall s a b sig m. (Member (State s) sig, Carrier sig m, Monad m) => ASetter s s a b -> (a -> b) -> m ()

Documentation

view :: forall r a sig m. (Member (Reader r) sig, Carrier sig m, Functor m) => Getting a r a -> m a Source #

View the value pointed to by a getter or lens, or the result of folding over all the results of a fold or traversal, when applied to the Reader context of the given monadic carrier.

views :: forall s a b sig m. (Member (Reader s) sig, Carrier sig m, Functor m) => Getting a s a -> (a -> b) -> m b Source #

View a function of the value pointed to by a getter or lens, or the result of folding over all the results of a fold or traversal, when applied to the Reader context of the given monadic carrier.

This is slightly more general in lens itself, but should suffice for our purposes.

use :: forall s a sig m. (Member (State s) sig, Carrier sig m, Monad m) => Getting a s a -> m a Source #

Extract the target of a lens or getter, or the result of folding over all the results of a fold or traversal, applied to the State context of the the given monadic carrier.

uses :: forall s a b f sig. (Carrier sig f, Functor f, Member (State s) sig) => Getting a s a -> (a -> b) -> f b Source #

Extract a function of the target of a lens or getter, or the result of folding over all the results of a fold or traversal, applied to the State context of the the given monadic carrier.

assign :: forall s a b sig m. (Member (State s) sig, Carrier sig m, Monad m) => ASetter s s a b -> b -> m () Source #

Replace the target of a lens (or all the targets of a setter or traversal) within the current monadic state, irrespective of the old value.

This is a prefix version of .=.

(.=) :: forall s a b sig m. (Member (State s) sig, Carrier sig m, Monad m) => ASetter s s a b -> b -> m () infixr 4 Source #

Replace the target of a lens (or all the targets of a setter or traversal) within the current monadic state, irrespective of the old value.

This is an infix version of assign.

modifying :: forall s a b sig m. (Member (State s) sig, Carrier sig m, Monad m) => ASetter s s a b -> (a -> b) -> m () Source #

Map over the target of a lens, or all of the targets of a setter or traversal, in the current monadic state.

This is a prefix version of %=.

(%=) :: forall s a b sig m. (Member (State s) sig, Carrier sig m, Monad m) => ASetter s s a b -> (a -> b) -> m () infixr 4 Source #

Map over the target of a lens, or all of the targets of a setter or traversal, in the current monadic state.

This is an infix version of modifying.