fused-effects-optics-0.1.0.0: Bridge between the optics and fused-effects ecosystems.

Control.Effect.Optics

Synopsis

eview :: forall r a m sig k is. (Is k A_Getter, Has (Reader r) sig m) => Optic' k is r a -> m a Source #

View the target of a Lens, Iso, or Getter in the current context.

This function is prefixed so as not to collide with view.

eviews :: forall r a b m sig k is. (Is k A_Getter, Has (Reader r) sig m) => Optic' k is r a -> (a -> b) -> m b Source #

Apply a function to the target of a Lens, Iso, or Getter in the current context.

# State operations

use :: forall s a m sig k is. (Is k A_Getter, Has (State s) sig m) => Optic' k is s a -> m a Source #

Use the target of a Lens, Iso, or Getter in the current state.

uses :: forall s a b m sig k is. (Is k A_Getter, Has (State s) sig m) => Optic' k is s a -> (a -> b) -> m b Source #

Apply a function to the target of a Lens, Iso, or Getter in the current state.

preuse :: forall s a m sig k is. (Is k An_AffineFold, Has (State s) sig m) => Optic' k is s a -> m (Maybe a) Source #

Use the target of a AffineTraversal or AffineFold in the current state.

assign :: forall s a b m sig k is. (Is k A_Setter, Has (State s) sig m) => Optic k is s s a b -> b -> m () Source #

Replace the target(s) of an Optic in our monadic state with a new value, irrespective of the old. The action and the optic operation are applied strictly.

This is aprefix form of .=.

modifying :: (Is k A_Setter, Has (State s) sig m) => Optic k is s s a b -> (a -> b) -> m () Source #

Map over the target(s) of an Optic in our monadic state. The action and the optic operation are applied strictly.

# Infix operators

(.=) :: forall s a b m sig k is. (Is k A_Setter, Has (State s) sig m) => Optic k is s s a b -> b -> m () infix 4 Source #

Replace the target(s) of an Optic in our monadic state with a new value, irrespective of the old. The action and the optic operation are applied strictly.

This is an infix form of assign.

(?=) :: forall s a b m sig k is. (Is k A_Setter, Has (State s) sig m) => Optic k is s s a (Maybe b) -> b -> m () infix 4 Source #

Replace the target(s) of an Optic in our monadic state with Just a new value, irrespective of the old. The action and the optic operation are applied strictly.

(%=) :: (Is k A_Setter, Has (State s) sig m) => Optic k is s s a b -> (a -> b) -> m () infix 4 Source #

Map over the target(s) of an Optic in our monadic state. The action and the optic operation are applied strictly.