freer-extras-0.1.0.0: Useful extensions to simple-freer
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Freer.Extras.Modify

Synopsis

change the list of effects

mapEffs :: (Union effs ~> Union effs') -> Eff effs ~> Eff effs' Source #

under functions

class UnderN as where Source #

Methods

underN :: (Union effs ~> Union effs') -> Union (as :++: effs) ~> Union (as :++: effs') Source #

Instances

Instances details
UnderN ('[] :: [Type -> Type]) Source # 
Instance details

Defined in Control.Monad.Freer.Extras.Modify

Methods

underN :: forall (effs :: [Type -> Type]) (effs' :: [Type -> Type]). (Union effs ~> Union effs') -> Union ('[] :++: effs) ~> Union ('[] :++: effs') Source #

UnderN as => UnderN (a ': as) Source # 
Instance details

Defined in Control.Monad.Freer.Extras.Modify

Methods

underN :: forall (effs :: [Type -> Type]) (effs' :: [Type -> Type]). (Union effs ~> Union effs') -> Union ((a ': as) :++: effs) ~> Union ((a ': as) :++: effs') Source #

under :: (Union effs ~> Union effs') -> Union (a ': effs) ~> Union (a ': effs') Source #

weaken functions

class CanWeakenEnd as effs where Source #

Methods

weakenEnd :: Union as ~> Union effs Source #

Instances

Instances details
(effs ~ (a ': effs'), CanWeakenEnd (b ': as) effs') => CanWeakenEnd (a ': (b ': as)) effs Source # 
Instance details

Defined in Control.Monad.Freer.Extras.Modify

Methods

weakenEnd :: Union (a ': (b ': as)) ~> Union effs Source #

effs ~ (a ': effs') => CanWeakenEnd '[a] effs Source # 
Instance details

Defined in Control.Monad.Freer.Extras.Modify

Methods

weakenEnd :: Union '[a] ~> Union effs Source #

weakenUnder :: forall effs a b. Union (a ': effs) ~> Union (a ': (b ': effs)) Source #

weakenNUnder :: forall effs' effs a. Weakens effs' => Union (a ': effs) ~> Union (a ': (effs' :++: effs)) Source #

weakenMUnderN :: forall effs' as effs. (UnderN as, Weakens effs') => Union (as :++: effs) ~> Union (as :++: (effs' :++: effs)) Source #

raise functions

raiseEnd :: forall effs as. CanWeakenEnd as effs => Eff as ~> Eff effs Source #

raiseUnder :: forall effs a b. Eff (a ': effs) ~> Eff (a ': (b ': effs)) Source #

raiseUnder2 :: forall effs a b c. Eff (a ': (b ': effs)) ~> Eff (a ': (b ': (c ': effs))) Source #

raise2Under :: forall effs a b c. Eff (a ': effs) ~> Eff (a ': (b ': (c ': effs))) Source #

raiseNUnder :: forall effs' effs a. Weakens effs' => Eff (a ': effs) ~> Eff (a ': (effs' :++: effs)) Source #

raiseMUnderN :: forall effs' as effs. (UnderN as, Weakens effs') => Eff (as :++: effs) ~> Eff (as :++: (effs' :++: effs)) Source #

Raise m effects under the top n effects

zoom functions

handleZoomedState :: Member (State s2) effs => Lens' s2 s1 -> State s1 ~> Eff effs Source #

Handle a State effect in terms of a "larger" State effect from which we have a lens.

handleZoomedError :: Member (Error s2) effs => AReview s2 s1 -> Error s1 ~> Eff effs Source #

Handle an Error effect in terms of a "larger" Error effect from which we have a review.

handleZoomedWriter :: Member (Writer s2) effs => AReview s2 s1 -> Writer s1 ~> Eff effs Source #

Handle a Writer effect in terms of a "larger" Writer effect from which we have a review.

handleZoomedReader :: Member (Reader s2) effs => Getter s2 s1 -> Reader s1 ~> Eff effs Source #

Handle a Reader effect in terms of a "larger" Reader effect from which we have a getter.

manipulation

writeIntoState :: (Monoid s1, Member (State s2) effs) => Setter' s2 s1 -> Writer s1 ~> Eff effs Source #

Handle a Writer effect in terms of a "larger" State effect from which we have a setter.

stateToMonadState :: MonadState s m => State s ~> m Source #

Handle a State effect in terms of a monadic effect which has a MonadState instance.

monadStateToState :: Member (State s) effs => State s a -> Eff effs a Source #

errorToMonadError :: MonadError e m => Error e ~> m Source #

Handle an Error effect in terms of a monadic effect which has a MonadError instance.

wrapError :: forall e f effs. Member (Error f) effs => (e -> f) -> Eff (Error e ': effs) ~> Eff effs Source #

Transform an error type