optics-core-0.1

Safe HaskellNone
LanguageHaskell2010

Optics.Operators.State

Contents

Synopsis

State modifying optics

(.=) :: (MonadState s m, Is k A_Setter) => Optic k is s s a b -> b -> m () infix 4 #

(?=) :: (MonadState s m, Is k A_Setter) => Optic k is s s (Maybe a) (Maybe b) -> b -> m () infix 4 #

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

State modifying optics with passthrough

(%%=) :: (MonadState s m, PermeableOptic k r) => Optic k is s s a b -> (a -> (r, b)) -> m (ViewResult k r) infix 4 #

Returning new value

(<.=) :: (MonadState s m, PermeableOptic k b) => Optic k is s s a b -> b -> m (ViewResult k b) infix 4 #

(<?=) :: (MonadState s m, PermeableOptic k (Maybe b)) => Optic k is s s (Maybe a) (Maybe b) -> b -> m (ViewResult k (Maybe b)) infix 4 #

(<%=) :: (MonadState s m, PermeableOptic k b) => Optic k is s s a b -> (a -> b) -> m (ViewResult k b) infix 4 #

Returning old value

(<<.=) :: (MonadState s m, PermeableOptic k a) => Optic k is s s a b -> b -> m (ViewResult k a) infix 4 #

(<<?=) :: (MonadState s m, PermeableOptic k (Maybe a)) => Optic k is s s (Maybe a) (Maybe b) -> b -> m (ViewResult k (Maybe a)) infix 4 #

(<<%=) :: (MonadState s m, PermeableOptic k a) => Optic k is s s a b -> (a -> b) -> m (ViewResult k a) infix 4 #

Passthrough

class (Is k A_Traversal, ViewableOptic k r) => PermeableOptic k r where #

Minimal complete definition

passthrough

Methods

passthrough :: Optic k is s t a b -> (a -> (r, b)) -> s -> (ViewResult k r, t) #

Modify the target of an Optic returning some extra information of type r.

Instances
Monoid r => PermeableOptic A_Traversal r # 
Instance details

Defined in Optics.Internal.Passthrough

Methods

passthrough :: Optic A_Traversal is s t a b -> (a -> (r, b)) -> s -> (ViewResult A_Traversal r, t) #

PermeableOptic An_AffineTraversal r # 
Instance details

Defined in Optics.Internal.Passthrough

Methods

passthrough :: Optic An_AffineTraversal is s t a b -> (a -> (r, b)) -> s -> (ViewResult An_AffineTraversal r, t) #

PermeableOptic A_Prism r # 
Instance details

Defined in Optics.Internal.Passthrough

Methods

passthrough :: Optic A_Prism is s t a b -> (a -> (r, b)) -> s -> (ViewResult A_Prism r, t) #

PermeableOptic A_Lens r # 
Instance details

Defined in Optics.Internal.Passthrough

Methods

passthrough :: Optic A_Lens is s t a b -> (a -> (r, b)) -> s -> (ViewResult A_Lens r, t) #

PermeableOptic An_Iso r # 
Instance details

Defined in Optics.Internal.Passthrough

Methods

passthrough :: Optic An_Iso is s t a b -> (a -> (r, b)) -> s -> (ViewResult An_Iso r, t) #