in-other-words-0.1.1.0: A higher-order effect system where the sky's the limit
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Fix

Synopsis

Effects

newtype Fix :: Effect where Source #

An effect corresponding to the MonadFix type class.

Effly's MonadFix instance is based on this effect; by having access to Fix, you're able to use recursive do notation inside of effect handlers.

Fix is typically used as a primitive effect. If you define a Carrier that relies on a novel non-trivial monad transformer t, then you need to make a ThreadsEff t Fix instance (if possible). threadFixViaClass can help you with that.

The following threading constraints accept Fix:

Constructors

Fix :: (a -> m a) -> Fix m a 

Instances

Instances details
ThreadsEff (ExceptT e) Fix Source # 
Instance details

Defined in Control.Effect.Type.Fix

Methods

threadEff :: Monad m => (forall x. Fix m x -> m x) -> Fix (ExceptT e m) a -> ExceptT e m a Source #

Monoid s => ThreadsEff (WriterT s) Fix Source # 
Instance details

Defined in Control.Effect.Type.Fix

Methods

threadEff :: Monad m => (forall x. Fix m x -> m x) -> Fix (WriterT s m) a -> WriterT s m a Source #

ThreadsEff (StateT s) Fix Source # 
Instance details

Defined in Control.Effect.Type.Fix

Methods

threadEff :: Monad m => (forall x. Fix m x -> m x) -> Fix (StateT s m) a -> StateT s m a Source #

ThreadsEff (ReaderT i) Fix Source # 
Instance details

Defined in Control.Effect.Type.Fix

Methods

threadEff :: Monad m => (forall x. Fix m x -> m x) -> Fix (ReaderT i m) a -> ReaderT i m a Source #

ThreadsEff (StateT s) Fix Source # 
Instance details

Defined in Control.Effect.Type.Fix

Methods

threadEff :: Monad m => (forall x. Fix m x -> m x) -> Fix (StateT s m) a -> StateT s m a Source #

Monoid s => ThreadsEff (WriterT s) Fix Source # 
Instance details

Defined in Control.Effect.Type.Fix

Methods

threadEff :: Monad m => (forall x. Fix m x -> m x) -> Fix (WriterT s m) a -> WriterT s m a Source #

ThreadsEff (WriterT s) Fix Source # 
Instance details

Defined in Control.Effect.Type.Fix

Methods

threadEff :: Monad m => (forall x. Fix m x -> m x) -> Fix (WriterT s m) a -> WriterT s m a Source #

(Reifies s (ReifiedEffAlgebra Fix m), Monad m) => MonadFix (ViaAlg s Fix m) Source # 
Instance details

Defined in Control.Effect.Type.Fix

Methods

mfix :: (a -> ViaAlg s Fix m a) -> ViaAlg s Fix m a #

Interpretations

fixToFinal :: (Carrier m, MonadFix m) => FixToFinalC m a -> m a Source #

Run a Fix effect if the final monad and all carriers transforming it are MonadFix.

Derivs (FixToFinalC m) = Fix ': Derivs m
Prims  (FixToFinalC m) = Fix ': Prims m

Threading utilities

threadFixViaClass :: Monad m => (RepresentationalT t, forall b. MonadFix b => MonadFix (t b)) => (forall x. Fix m x -> m x) -> Fix (t m) a -> t m a Source #

A valid definition of threadEff for a ThreadsEff t Fix instance, given that t lifts MonadFix.

Carriers