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

Control.Effect.Carrier.Internal.Interpret

Synopsis

Documentation

data HandlerCState p m z Source #

Constructors

HandlerCState (forall x. m x -> z x) (Algebra p z) 

newtype ReifiedReformulation r p m Source #

Instances

Instances details
(Carrier m, r ~ Derivs m, p ~ Prims m) => Reifies (CarrierReform m :: Type) (ReifiedReformulation r p m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

newtype HandlerC (sHandler :: *) (sReform :: *) (r :: [Effect]) (p :: [Effect]) (m :: * -> *) z (a :: *) Source #

Constructors

HandlerC 

Fields

Instances

Instances details
(Reifies sHandler (HandlerCState p m z), Monad z, Monad m) => MonadBase m (HandlerC sHandler sReform r p m z) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftBase :: m α -> HandlerC sHandler sReform r p m z α #

Monad z => Monad (HandlerC sHandler sReform r p m z) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

(>>=) :: HandlerC sHandler sReform r p m z a -> (a -> HandlerC sHandler sReform r p m z b) -> HandlerC sHandler sReform r p m z b #

(>>) :: HandlerC sHandler sReform r p m z a -> HandlerC sHandler sReform r p m z b -> HandlerC sHandler sReform r p m z b #

return :: a -> HandlerC sHandler sReform r p m z a #

Functor z => Functor (HandlerC sHandler sReform r p m z) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fmap :: (a -> b) -> HandlerC sHandler sReform r p m z a -> HandlerC sHandler sReform r p m z b #

(<$) :: a -> HandlerC sHandler sReform r p m z b -> HandlerC sHandler sReform r p m z a #

Applicative z => Applicative (HandlerC sHandler sReform r p m z) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

pure :: a -> HandlerC sHandler sReform r p m z a #

(<*>) :: HandlerC sHandler sReform r p m z (a -> b) -> HandlerC sHandler sReform r p m z a -> HandlerC sHandler sReform r p m z b #

liftA2 :: (a -> b -> c) -> HandlerC sHandler sReform r p m z a -> HandlerC sHandler sReform r p m z b -> HandlerC sHandler sReform r p m z c #

(*>) :: HandlerC sHandler sReform r p m z a -> HandlerC sHandler sReform r p m z b -> HandlerC sHandler sReform r p m z b #

(<*) :: HandlerC sHandler sReform r p m z a -> HandlerC sHandler sReform r p m z b -> HandlerC sHandler sReform r p m z a #

(Reifies sHandler (HandlerCState p m z), Reifies sReform (ReifiedReformulation r p m), Monad z) => Carrier (HandlerC sHandler sReform r p m z) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type Derivs (HandlerC sHandler sReform r p m z) :: [Effect] Source #

type Prims (HandlerC sHandler sReform r p m z) :: [Effect] Source #

Methods

algPrims :: Algebra' (Prims (HandlerC sHandler sReform r p m z)) (HandlerC sHandler sReform r p m z) a Source #

reformulate :: Monad z0 => Reformulation' (Derivs (HandlerC sHandler sReform r p m z)) (Prims (HandlerC sHandler sReform r p m z)) (HandlerC sHandler sReform r p m z) z0 a Source #

algDerivs :: Algebra' (Derivs (HandlerC sHandler sReform r p m z)) (HandlerC sHandler sReform r p m z) a Source #

type Derivs (HandlerC sHandler sReform r p m z) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Derivs (HandlerC sHandler sReform r p m z) = r
type Prims (HandlerC sHandler sReform r p m z) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Prims (HandlerC sHandler sReform r p m z) = p

data CarrierReform m Source #

Instances

Instances details
(Carrier m, r ~ Derivs m, p ~ Prims m) => Reifies (CarrierReform m :: Type) (ReifiedReformulation r p m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

newtype InterpretPrimC (s :: *) (e :: Effect) (m :: * -> *) a Source #

Constructors

InterpretPrimC 

Fields

Instances

Instances details
MonadBase b m => MonadBase b (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftBase :: b α -> InterpretPrimC s e m α #

MonadBaseControl b m => MonadBaseControl b (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StM (InterpretPrimC s e m) a #

Methods

liftBaseWith :: (RunInBase (InterpretPrimC s e m) b -> b a) -> InterpretPrimC s e m a #

restoreM :: StM (InterpretPrimC s e m) a -> InterpretPrimC s e m a #

MonadTrans (InterpretPrimC s e) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

lift :: Monad m => m a -> InterpretPrimC s e m a #

MonadTransControl (InterpretPrimC s e) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StT (InterpretPrimC s e) a #

Methods

liftWith :: Monad m => (Run (InterpretPrimC s e) -> m a) -> InterpretPrimC s e m a #

restoreT :: Monad m => m (StT (InterpretPrimC s e) a) -> InterpretPrimC s e m a #

Monad m => Monad (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

(>>=) :: InterpretPrimC s e m a -> (a -> InterpretPrimC s e m b) -> InterpretPrimC s e m b #

(>>) :: InterpretPrimC s e m a -> InterpretPrimC s e m b -> InterpretPrimC s e m b #

return :: a -> InterpretPrimC s e m a #

Functor m => Functor (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fmap :: (a -> b) -> InterpretPrimC s e m a -> InterpretPrimC s e m b #

(<$) :: a -> InterpretPrimC s e m b -> InterpretPrimC s e m a #

MonadFix m => MonadFix (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mfix :: (a -> InterpretPrimC s e m a) -> InterpretPrimC s e m a #

MonadFail m => MonadFail (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fail :: String -> InterpretPrimC s e m a #

Applicative m => Applicative (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

pure :: a -> InterpretPrimC s e m a #

(<*>) :: InterpretPrimC s e m (a -> b) -> InterpretPrimC s e m a -> InterpretPrimC s e m b #

liftA2 :: (a -> b -> c) -> InterpretPrimC s e m a -> InterpretPrimC s e m b -> InterpretPrimC s e m c #

(*>) :: InterpretPrimC s e m a -> InterpretPrimC s e m b -> InterpretPrimC s e m b #

(<*) :: InterpretPrimC s e m a -> InterpretPrimC s e m b -> InterpretPrimC s e m a #

MonadIO m => MonadIO (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftIO :: IO a -> InterpretPrimC s e m a #

Alternative m => Alternative (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

empty :: InterpretPrimC s e m a #

(<|>) :: InterpretPrimC s e m a -> InterpretPrimC s e m a -> InterpretPrimC s e m a #

some :: InterpretPrimC s e m a -> InterpretPrimC s e m [a] #

many :: InterpretPrimC s e m a -> InterpretPrimC s e m [a] #

MonadPlus m => MonadPlus (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mzero :: InterpretPrimC s e m a #

mplus :: InterpretPrimC s e m a -> InterpretPrimC s e m a -> InterpretPrimC s e m a #

MonadThrow m => MonadThrow (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

throwM :: Exception e0 => e0 -> InterpretPrimC s e m a #

MonadCatch m => MonadCatch (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => InterpretPrimC s e m a -> (e0 -> InterpretPrimC s e m a) -> InterpretPrimC s e m a #

MonadMask m => MonadMask (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mask :: ((forall a. InterpretPrimC s e m a -> InterpretPrimC s e m a) -> InterpretPrimC s e m b) -> InterpretPrimC s e m b #

uninterruptibleMask :: ((forall a. InterpretPrimC s e m a -> InterpretPrimC s e m a) -> InterpretPrimC s e m b) -> InterpretPrimC s e m b #

generalBracket :: InterpretPrimC s e m a -> (a -> ExitCase b -> InterpretPrimC s e m c) -> (a -> InterpretPrimC s e m b) -> InterpretPrimC s e m (b, c) #

PrimHandler h e m => Carrier (InterpretPrimC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type Derivs (InterpretPrimC h e m) :: [Effect] Source #

type Prims (InterpretPrimC h e m) :: [Effect] Source #

type StT (InterpretPrimC s e) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StT (InterpretPrimC s e) a = StT (IdentityT :: (Type -> Type) -> Type -> Type) a
type Derivs (InterpretPrimC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Derivs (InterpretPrimC h e m) = e ': Derivs m
type Prims (InterpretPrimC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Prims (InterpretPrimC h e m) = e ': Prims m
type StM (InterpretPrimC s e m) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StM (InterpretPrimC s e m) a = StM m a

class (RepresentationalEff e, Carrier m) => Handler (h :: *) e m where Source #

The class of effect handlers for derived effects. Instances of this class can be used together interpretViaHandler in order to interpret effects.

h is the tag for the handler, e is the effect to interpret, and m is the Carrier on which the handler operates.

To define your own interpreter using this method, create a new datatype without any constructors to serve as the tag for the handler, and then define a Handler instance for it. Then, you can use your handler to interpret effects with interpretViaHandler.

Alternatively, you can use interpret or interpretSimple, which lets you avoid the need to define instances of Handler, but come at other costs.

type EffHandler e m = forall z x. (Carrier z, Derivs z ~ Derivs m, Prims z ~ Prims m, MonadBase m z) => e (Effly z) x -> Effly z x Source #

The type of effect handlers for a derived effect e with current carrier m.

Don't let the type overwhelm you; in most cases, you can treat this as e m x -> m x.

Any EffHandler is required to work with any carrier monad z that lifts m, and has the same derived and primitive effects as m does. The only constraints that are propagated to z are membership constraints: MonadIO m doesn't imply MonadIO z, but Eff (Embed IO) m does imply Eff (Embed IO) z.

In addition, since z lifts m, you can lift values of m to z through liftBase. This is most useful when using interpret or interpretSimple, as it allows you to bring monadic values of m from outside of the handler (like arguments to the interpreter) into the handler.

The z provided to the handler has Effly wrapped around it, so the handler may make use of the various instances of Effly. For example, you have access to MonadFix inside the handler if you have Eff Fix m.

Any effect to be handled needs to be representational in the monad parameter. See RepresentationalEff for more information.

type EffPrimHandler e m = forall x. e m x -> m x Source #

The type of effect handlers for a primitive effect e with current carrier m.

Unlike EffHandlers, EffPrimHandlers have direct access to m, making them significantly more powerful.

That said, you should interpret your own effects as primitives only as a last resort. Every primitive effect comes at the cost of enormous amounts of boilerplate: namely, the need for a ThreadsEff instance for every monad transformer that can thread that effect.

Some effects in this library are intended to be used as primitive effects, such as Regional. Try to use such effects to gain the power you need to interpret your effects instead of defining your own primitive effects, since the primitive effects offered in this library already have ThreadsEff instances defined for them.

class (RepresentationalEff e, Carrier m) => PrimHandler (h :: *) e m where Source #

The class of effect handlers for primitive effects. Instances of this class can be used together interpretPrimViaHandler in order to interpret primitive effects.

h is the tag for the handler, e is the effect to interpret, and m is the Carrier on which the handler operates.

To define your own interpreter using this method, create a new datatype without any constructors to serve as the tag for the handler, and then define a PrimHandler instance for it. Then, you can use your handler to interpret effects with interpretPrimViaHandler.

Alternatively, you can use interpretPrim or interpretPrimSimple, which lets you avoid the need to define instances of PrimHandler, but come at other costs.

Only interpret your own effects as primitives as a last resort. See EffPrimHandler.

Instances

Instances details
Carrier m => PrimHandler UnliftH (Unlift m) m Source # 
Instance details

Defined in Control.Effect.Internal.Unlift

(Carrier m, MonadBaseControl b m) => PrimHandler HoistToFinalH (Hoist b) m Source # 
Instance details

Defined in Control.Effect.Internal.Regional

Carrier m => PrimHandler HoistH (Hoist m) m Source # 
Instance details

Defined in Control.Effect.Internal.Regional

Carrier m => PrimHandler HoistOptionH (HoistOption m) m Source # 
Instance details

Defined in Control.Effect.Internal.Optional

Carrier m => PrimHandler BaseControlH (BaseControl m) m Source # 
Instance details

Defined in Control.Effect.Internal.BaseControl

(Monoid w, Carrier m, Threaders '[SteppedThreads] m p) => PrimHandler ListenSteppedH (ListenPrim w) (SteppedC (Tell w) m) Source # 
Instance details

Defined in Control.Effect.Internal.Intercept

(FirstOrder e, Carrier m, Threaders '[SteppedThreads] m p) => PrimHandler InterceptH (Unravel (InterceptB e)) (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Intercept

(RepresentationalEff e, Carrier m, Reifies s (ReifiedPrimHandler e m)) => PrimHandler (ViaReifiedH s) e m Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

newtype InterpretC (h :: *) (e :: Effect) (m :: * -> *) a Source #

Constructors

InterpretC 

Fields

Instances

Instances details
MonadBase b m => MonadBase b (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftBase :: b α -> InterpretC h e m α #

MonadBaseControl b m => MonadBaseControl b (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StM (InterpretC h e m) a #

Methods

liftBaseWith :: (RunInBase (InterpretC h e m) b -> b a) -> InterpretC h e m a #

restoreM :: StM (InterpretC h e m) a -> InterpretC h e m a #

MonadTrans (InterpretC h e) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

lift :: Monad m => m a -> InterpretC h e m a #

MonadTransControl (InterpretC h e) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StT (InterpretC h e) a #

Methods

liftWith :: Monad m => (Run (InterpretC h e) -> m a) -> InterpretC h e m a #

restoreT :: Monad m => m (StT (InterpretC h e) a) -> InterpretC h e m a #

Monad m => Monad (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

(>>=) :: InterpretC h e m a -> (a -> InterpretC h e m b) -> InterpretC h e m b #

(>>) :: InterpretC h e m a -> InterpretC h e m b -> InterpretC h e m b #

return :: a -> InterpretC h e m a #

Functor m => Functor (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fmap :: (a -> b) -> InterpretC h e m a -> InterpretC h e m b #

(<$) :: a -> InterpretC h e m b -> InterpretC h e m a #

MonadFix m => MonadFix (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mfix :: (a -> InterpretC h e m a) -> InterpretC h e m a #

MonadFail m => MonadFail (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fail :: String -> InterpretC h e m a #

Applicative m => Applicative (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

pure :: a -> InterpretC h e m a #

(<*>) :: InterpretC h e m (a -> b) -> InterpretC h e m a -> InterpretC h e m b #

liftA2 :: (a -> b -> c) -> InterpretC h e m a -> InterpretC h e m b -> InterpretC h e m c #

(*>) :: InterpretC h e m a -> InterpretC h e m b -> InterpretC h e m b #

(<*) :: InterpretC h e m a -> InterpretC h e m b -> InterpretC h e m a #

MonadIO m => MonadIO (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftIO :: IO a -> InterpretC h e m a #

Alternative m => Alternative (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

empty :: InterpretC h e m a #

(<|>) :: InterpretC h e m a -> InterpretC h e m a -> InterpretC h e m a #

some :: InterpretC h e m a -> InterpretC h e m [a] #

many :: InterpretC h e m a -> InterpretC h e m [a] #

MonadPlus m => MonadPlus (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mzero :: InterpretC h e m a #

mplus :: InterpretC h e m a -> InterpretC h e m a -> InterpretC h e m a #

MonadThrow m => MonadThrow (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

throwM :: Exception e0 => e0 -> InterpretC h e m a #

MonadCatch m => MonadCatch (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => InterpretC h e m a -> (e0 -> InterpretC h e m a) -> InterpretC h e m a #

MonadMask m => MonadMask (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mask :: ((forall a. InterpretC h e m a -> InterpretC h e m a) -> InterpretC h e m b) -> InterpretC h e m b #

uninterruptibleMask :: ((forall a. InterpretC h e m a -> InterpretC h e m a) -> InterpretC h e m b) -> InterpretC h e m b #

generalBracket :: InterpretC h e m a -> (a -> ExitCase b -> InterpretC h e m c) -> (a -> InterpretC h e m b) -> InterpretC h e m (b, c) #

(Carrier m, Handler h e m) => Carrier (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type Derivs (InterpretC h e m) :: [Effect] Source #

type Prims (InterpretC h e m) :: [Effect] Source #

type StT (InterpretC h e) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StT (InterpretC h e) a = StT (IdentityT :: (Type -> Type) -> Type -> Type) a
type Derivs (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Derivs (InterpretC h e m) = e ': Derivs m
type Prims (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Prims (InterpretC h e m) = Prims m
type StM (InterpretC h e m) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StM (InterpretC h e m) a = StM m a

newtype ReifiedHandler e m Source #

Constructors

ReifiedHandler 

newtype ReifiedPrimHandler (e :: Effect) m Source #

Constructors

ReifiedPrimHandler 

Fields

coerceHandler :: (RepresentationalEff e, Coercible m n) => (e m a -> m a) -> e n a -> n a Source #

type InterpretReifiedC e m a = forall s. ReifiesHandler s e m => InterpretC (ViaReifiedH s) e m a Source #

newtype InterpretSimpleC (e :: Effect) (m :: * -> *) a Source #

Constructors

InterpretSimpleC 

Instances

Instances details
MonadBase b m => MonadBase b (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftBase :: b α -> InterpretSimpleC e m α #

MonadBaseControl b m => MonadBaseControl b (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StM (InterpretSimpleC e m) a #

MonadTrans (InterpretSimpleC e) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

lift :: Monad m => m a -> InterpretSimpleC e m a #

Monad m => Monad (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

(>>=) :: InterpretSimpleC e m a -> (a -> InterpretSimpleC e m b) -> InterpretSimpleC e m b #

(>>) :: InterpretSimpleC e m a -> InterpretSimpleC e m b -> InterpretSimpleC e m b #

return :: a -> InterpretSimpleC e m a #

Functor m => Functor (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fmap :: (a -> b) -> InterpretSimpleC e m a -> InterpretSimpleC e m b #

(<$) :: a -> InterpretSimpleC e m b -> InterpretSimpleC e m a #

MonadFix m => MonadFix (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mfix :: (a -> InterpretSimpleC e m a) -> InterpretSimpleC e m a #

MonadFail m => MonadFail (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fail :: String -> InterpretSimpleC e m a #

Applicative m => Applicative (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

pure :: a -> InterpretSimpleC e m a #

(<*>) :: InterpretSimpleC e m (a -> b) -> InterpretSimpleC e m a -> InterpretSimpleC e m b #

liftA2 :: (a -> b -> c) -> InterpretSimpleC e m a -> InterpretSimpleC e m b -> InterpretSimpleC e m c #

(*>) :: InterpretSimpleC e m a -> InterpretSimpleC e m b -> InterpretSimpleC e m b #

(<*) :: InterpretSimpleC e m a -> InterpretSimpleC e m b -> InterpretSimpleC e m a #

MonadIO m => MonadIO (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftIO :: IO a -> InterpretSimpleC e m a #

Alternative m => Alternative (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

MonadPlus m => MonadPlus (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

MonadThrow m => MonadThrow (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

throwM :: Exception e0 => e0 -> InterpretSimpleC e m a #

MonadCatch m => MonadCatch (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => InterpretSimpleC e m a -> (e0 -> InterpretSimpleC e m a) -> InterpretSimpleC e m a #

MonadMask m => MonadMask (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mask :: ((forall a. InterpretSimpleC e m a -> InterpretSimpleC e m a) -> InterpretSimpleC e m b) -> InterpretSimpleC e m b #

uninterruptibleMask :: ((forall a. InterpretSimpleC e m a -> InterpretSimpleC e m a) -> InterpretSimpleC e m b) -> InterpretSimpleC e m b #

generalBracket :: InterpretSimpleC e m a -> (a -> ExitCase b -> InterpretSimpleC e m c) -> (a -> InterpretSimpleC e m b) -> InterpretSimpleC e m (b, c) #

(Threads (ReaderT (ReifiedHandler e m)) (Prims m), RepresentationalEff e, Carrier m) => Carrier (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type Derivs (InterpretSimpleC e m) :: [Effect] Source #

type Prims (InterpretSimpleC e m) :: [Effect] Source #

type Derivs (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Derivs (InterpretSimpleC e m) = e ': Derivs m
type Prims (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StM (InterpretSimpleC e m) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StM (InterpretSimpleC e m) a = StM (ReaderT (ReifiedHandler e m) m) a

newtype InterpretPrimSimpleC (e :: Effect) (m :: * -> *) a Source #

Instances

Instances details
MonadBase b m => MonadBase b (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftBase :: b α -> InterpretPrimSimpleC e m α #

MonadBaseControl b m => MonadBaseControl b (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StM (InterpretPrimSimpleC e m) a #

MonadTrans (InterpretPrimSimpleC e) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

lift :: Monad m => m a -> InterpretPrimSimpleC e m a #

Monad m => Monad (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Functor m => Functor (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fmap :: (a -> b) -> InterpretPrimSimpleC e m a -> InterpretPrimSimpleC e m b #

(<$) :: a -> InterpretPrimSimpleC e m b -> InterpretPrimSimpleC e m a #

MonadFix m => MonadFix (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mfix :: (a -> InterpretPrimSimpleC e m a) -> InterpretPrimSimpleC e m a #

MonadFail m => MonadFail (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fail :: String -> InterpretPrimSimpleC e m a #

Applicative m => Applicative (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

MonadIO m => MonadIO (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftIO :: IO a -> InterpretPrimSimpleC e m a #

Alternative m => Alternative (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

MonadPlus m => MonadPlus (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

MonadThrow m => MonadThrow (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

throwM :: Exception e0 => e0 -> InterpretPrimSimpleC e m a #

MonadCatch m => MonadCatch (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => InterpretPrimSimpleC e m a -> (e0 -> InterpretPrimSimpleC e m a) -> InterpretPrimSimpleC e m a #

MonadMask m => MonadMask (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

(Threads (ReaderT (ReifiedPrimHandler e m)) (Prims m), ThreadsEff (ReaderT (ReifiedPrimHandler e m)) e, RepresentationalEff e, Carrier m) => Carrier (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type Derivs (InterpretPrimSimpleC e m) :: [Effect] Source #

type Prims (InterpretPrimSimpleC e m) :: [Effect] Source #

type Derivs (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Derivs (InterpretPrimSimpleC e m) = e ': Derivs m
type Prims (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Prims (InterpretPrimSimpleC e m) = e ': Prims m
type StM (InterpretPrimSimpleC e m) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

interpret :: forall e m a. (RepresentationalEff e, Carrier m) => EffHandler e m -> InterpretReifiedC e m a -> m a Source #

Interpret an effect in terms of other effects, without needing to define an explicit Handler instance. This is an alternative to interpretViaHandler, and is more performant than interpretSimple.

See EffHandler for more information about the handler you pass to this function.

Derivs (InterpretReifiedC e m) = e ': Derivs m
Prims  (InterpretReifiedC e m) = Prims m

This has a higher-rank type, as it makes use of InterpretReifiedC. This makes interpret very difficult to use partially applied. In particular, it can't be composed using .. You must use paranthesis or $.

Consider using interpretSimple instead if performance is secondary.

Example usage:

data Teletype :: Effect where
  ReadTTY  :: Teletype m String
  WriteTTY :: String -> Teletype m ()

readTTY :: Eff Teletype m => m String
readTTY = send ReadTTY

writeTTY :: Eff Teletype m => String -> m ()
writeTTY = send . WriteTTY

echo :: Eff Teletype m => m ()
echo = readTTY >>= sendTTY

teletypeToIO :: Eff (Embed IO) m => InterpreterFor Teletype m
teletypeToIO = interpret $ case
  ReadTTY -> embed getLine
  WriteTTY str -> embed $ putStrLn str

main :: IO ()
main = runM $ teletypeToIO $ echo

interpretSimple :: forall e m a p. (RepresentationalEff e, Threaders '[ReaderThreads] m p, Carrier m) => EffHandler e m -> InterpretSimpleC e m a -> m a Source #

Interpret an effect in terms of other effects, without needing to define an explicit Handler instance. This is an alternative to interpretViaHandler.

See EffHandler for more information about the handler you pass to this function.

Derivs (InterpretSimpleC e m) = e ': Derivs m
Prims  (InterpretSimpleC e m) = Prims m

This is a significantly slower variant of interpret that doesn't have a higher-ranked type, making it much easier to use partially applied.

Note: this emits the threading constraint ReaderThreads (see Threaders). This makes interpretSimple significantly less attractive to use in application code, as it means propagating that constraint through your application.

Example usage:

data Teletype :: Effect where
  ReadTTY  :: Teletype m String
  WriteTTY :: String -> Teletype m ()

readTTY :: Eff Teletype m => m String
readTTY = send ReadTTY

writeTTY :: Eff Teletype m => String -> m ()
writeTTY = send . WriteTTY

echo :: Eff Teletype m => m ()
echo = readTTY >>= sendTTY

teletypeToIO :: Eff (Embed IO) m => SimpleInterpreterFor Teletype m
teletypeToIO = interpretSimple $ case
  ReadTTY -> embed getLine
  WriteTTY str -> embed $ putStrLn str

main :: IO ()
main = runM $ teletypeToIO $ echo

interpretViaHandler :: forall h e m a. Handler h e m => InterpretC h e m a -> m a Source #

Interpret an effect in terms of other effects by using an explicit Handler instance.

See Handler for more information.

Unlike interpret, this does not have a higher-rank type, making it easier to use partially applied, and unlike interpretSimple doesn't sacrifice performance.

Derivs (InterpretC h e m) = e ': Derivs m
Prims  (InterpretC h e m) = Prims m

Example usage:

data Teletype :: Effect where
  ReadTTY  :: Teletype m String
  WriteTTY :: String -> Teletype m ()

readTTY :: Eff Teletype m => m String
readTTY = send ReadTTY

writeTTY :: Eff Teletype m => String -> m ()
writeTTY = send . WriteTTY

echo :: Eff Teletype m => m ()
echo = readTTY >>= sendTTY

data TeletypeToIOH

instance Eff (Embed IO) m
      => Handler TeletypeToIOH Teletype m where
  effHandler = case
    ReadTTY -> embed getLine
    WriteTTY str -> embed $ putStrLn str

type TeletypeToIOC = InterpretC TeletypeToIOH Teletype

teletypeToIO :: Eff (Embed IO) m => TeletypeToIOC m a -> m a
teletypeToIO = interpretViaHandler

main :: IO ()
main = runM $ teletypeToIO $ echo

interpretPrim :: forall e m a. (RepresentationalEff e, Carrier m) => EffPrimHandler e m -> InterpretPrimReifiedC e m a -> m a Source #

Interpret an effect as a new primitive effect.

Only interpret your own effects as primitives as a last resort. See EffPrimHandler.

Derivs (InterpretPrimReifiedC e m) = e ': Derivs m
Prims  (InterpretPrimReifiedC e m) = e ': Prims m

This has a higher-rank type, as it makes use of InterpretPrimReifiedC. This makes interpretPrim very difficult to use partially applied. In particular, it can't be composed using .. You must use paranthesis or $.

Consider using interpretPrimSimple instead if performance is secondary.

interpretPrimViaHandler :: forall h e m a. PrimHandler h e m => InterpretPrimC h e m a -> m a Source #

Interpret an effect as a new primitive effect by using an explicit PrimHandler instance.

See PrimHandler for more information.

Only interpret your own effects as primitives as a last resort. See EffPrimHandler.

interpretPrimSimple :: forall e m a p. (RepresentationalEff e, Threaders '[ReaderThreads] m p, ReaderThreads '[e], Carrier m) => EffPrimHandler e m -> InterpretPrimSimpleC e m a -> m a Source #

A significantly slower variant of interpretPrim that doesn't have a higher-ranked type, making it much easier to use partially applied.

Only interpret your own effects as primitives as a last resort. See EffPrimHandler.

Derivs (InterpretPrimSimpleC e m) = e ': Derivs m
Prims  (InterpretPrimSimpleC e m) = e ': Prims m

Note the ReaderThreads '[e] constraint, meaning you need to define a ThreadsEff e (ReaderT i) instance in order to use interpretPrimSimple.

addDeriv :: (RepresentationalEff e, Monad m) => (forall z x. (Carrier z, Derivs z ~ r, Prims z ~ p, MonadBase m z) => e (Effly z) x -> Effly z x) -> Reformulation r p m -> Reformulation (e ': r) p m Source #

Add a derived effect to a Reformulation by providing a handler for that effect.

The handler is an EffHandler, but with derived and primitive effects determined by the transformed Reformulation.

newtype ReinterpretC h e new m a Source #

Constructors

ReinterpretC 

Fields

Instances

Instances details
MonadBase b m => MonadBase b (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftBase :: b α -> ReinterpretC h e new m α #

MonadBaseControl b m => MonadBaseControl b (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StM (ReinterpretC h e new m) a #

Methods

liftBaseWith :: (RunInBase (ReinterpretC h e new m) b -> b a) -> ReinterpretC h e new m a #

restoreM :: StM (ReinterpretC h e new m) a -> ReinterpretC h e new m a #

MonadTrans (ReinterpretC h e new) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

lift :: Monad m => m a -> ReinterpretC h e new m a #

MonadTransControl (ReinterpretC h e new) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StT (ReinterpretC h e new) a #

Methods

liftWith :: Monad m => (Run (ReinterpretC h e new) -> m a) -> ReinterpretC h e new m a #

restoreT :: Monad m => m (StT (ReinterpretC h e new) a) -> ReinterpretC h e new m a #

Monad m => Monad (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

(>>=) :: ReinterpretC h e new m a -> (a -> ReinterpretC h e new m b) -> ReinterpretC h e new m b #

(>>) :: ReinterpretC h e new m a -> ReinterpretC h e new m b -> ReinterpretC h e new m b #

return :: a -> ReinterpretC h e new m a #

Functor m => Functor (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fmap :: (a -> b) -> ReinterpretC h e new m a -> ReinterpretC h e new m b #

(<$) :: a -> ReinterpretC h e new m b -> ReinterpretC h e new m a #

MonadFix m => MonadFix (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mfix :: (a -> ReinterpretC h e new m a) -> ReinterpretC h e new m a #

MonadFail m => MonadFail (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fail :: String -> ReinterpretC h e new m a #

Applicative m => Applicative (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

pure :: a -> ReinterpretC h e new m a #

(<*>) :: ReinterpretC h e new m (a -> b) -> ReinterpretC h e new m a -> ReinterpretC h e new m b #

liftA2 :: (a -> b -> c) -> ReinterpretC h e new m a -> ReinterpretC h e new m b -> ReinterpretC h e new m c #

(*>) :: ReinterpretC h e new m a -> ReinterpretC h e new m b -> ReinterpretC h e new m b #

(<*) :: ReinterpretC h e new m a -> ReinterpretC h e new m b -> ReinterpretC h e new m a #

MonadIO m => MonadIO (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftIO :: IO a -> ReinterpretC h e new m a #

Alternative m => Alternative (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

empty :: ReinterpretC h e new m a #

(<|>) :: ReinterpretC h e new m a -> ReinterpretC h e new m a -> ReinterpretC h e new m a #

some :: ReinterpretC h e new m a -> ReinterpretC h e new m [a] #

many :: ReinterpretC h e new m a -> ReinterpretC h e new m [a] #

MonadPlus m => MonadPlus (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mzero :: ReinterpretC h e new m a #

mplus :: ReinterpretC h e new m a -> ReinterpretC h e new m a -> ReinterpretC h e new m a #

MonadThrow m => MonadThrow (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

throwM :: Exception e0 => e0 -> ReinterpretC h e new m a #

MonadCatch m => MonadCatch (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => ReinterpretC h e new m a -> (e0 -> ReinterpretC h e new m a) -> ReinterpretC h e new m a #

MonadMask m => MonadMask (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mask :: ((forall a. ReinterpretC h e new m a -> ReinterpretC h e new m a) -> ReinterpretC h e new m b) -> ReinterpretC h e new m b #

uninterruptibleMask :: ((forall a. ReinterpretC h e new m a -> ReinterpretC h e new m a) -> ReinterpretC h e new m b) -> ReinterpretC h e new m b #

generalBracket :: ReinterpretC h e new m a -> (a -> ExitCase b -> ReinterpretC h e new m c) -> (a -> ReinterpretC h e new m b) -> ReinterpretC h e new m (b, c) #

(Handler h e m, Carrier m, KnownList new, IntroConsistent ('[] :: [Effect]) new m) => Carrier (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type Derivs (ReinterpretC h e new m) :: [Effect] Source #

type Prims (ReinterpretC h e new m) :: [Effect] Source #

Methods

algPrims :: Algebra' (Prims (ReinterpretC h e new m)) (ReinterpretC h e new m) a Source #

reformulate :: Monad z => Reformulation' (Derivs (ReinterpretC h e new m)) (Prims (ReinterpretC h e new m)) (ReinterpretC h e new m) z a Source #

algDerivs :: Algebra' (Derivs (ReinterpretC h e new m)) (ReinterpretC h e new m) a Source #

type StT (ReinterpretC h e new) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StT (ReinterpretC h e new) a = StT (IdentityT :: (Type -> Type) -> Type -> Type) a
type Derivs (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Derivs (ReinterpretC h e new m) = Derivs (IntroUnderC e new (InterpretC h e m))
type Prims (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Prims (ReinterpretC h e new m) = Prims (IntroUnderC e new (InterpretC h e m))
type StM (ReinterpretC h e new m) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StM (ReinterpretC h e new m) a = StM (IntroC '[e] new (InterpretC h e m)) a

type ReinterpretReifiedC e new m a = forall s. ReifiesHandler s e m => ReinterpretC (ViaReifiedH s) e new m a Source #

reinterpret :: forall e new m a. (RepresentationalEff e, KnownList new, HeadEffs new m) => EffHandler e m -> ReinterpretReifiedC e new m a -> m a Source #

Reinterpret an effect in terms of newly introduced effects.

This combines interpret and introUnder in order to introduce the effects new under e, which you then may make use of inside the handler for e.

Derivs (ReinterpretReifiedC e new m) = e ': StripPrefix new (Derivs m)
Prims  (ReinterpretReifiedC e new m) = Prims m

This has a higher-rank type, as it makes use of ReinterpretReifiedC. This makes reinterpret very difficult to use partially applied. In particular, it can't be composed using .. You must use paranthesis or $.

Consider using reinterpretSimple instead if performance is secondary.

reinterpretViaHandler :: forall h e new m a. (Handler h e m, KnownList new, HeadEffs new m) => ReinterpretC h e new m a -> m a Source #

Reinterpret an effect in terms of newly introduced effects by using an explicit Handler instance.

See Handler for more information.

This combines interpretViaHandler and introUnder in order to introduce the effects new under e, which you then may make use of inside the handler for e.

Derivs (ReinterpretC h e new m) = e ': StripPrefix new (Derivs m)
Prims  (ReinterpretC h e new m) = Prims m

Unlike reinterpret, this does not have a higher-rank type, making it easier to use partially applied, and unlike reinterpretSimple doesn't sacrifice performance.

newtype ReinterpretSimpleC e new m a Source #

Instances

Instances details
MonadBase b m => MonadBase b (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftBase :: b α -> ReinterpretSimpleC e new m α #

MonadBaseControl b m => MonadBaseControl b (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type StM (ReinterpretSimpleC e new m) a #

Methods

liftBaseWith :: (RunInBase (ReinterpretSimpleC e new m) b -> b a) -> ReinterpretSimpleC e new m a #

restoreM :: StM (ReinterpretSimpleC e new m) a -> ReinterpretSimpleC e new m a #

MonadTrans (ReinterpretSimpleC e new) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

lift :: Monad m => m a -> ReinterpretSimpleC e new m a #

Monad m => Monad (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

(>>=) :: ReinterpretSimpleC e new m a -> (a -> ReinterpretSimpleC e new m b) -> ReinterpretSimpleC e new m b #

(>>) :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m b -> ReinterpretSimpleC e new m b #

return :: a -> ReinterpretSimpleC e new m a #

Functor m => Functor (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fmap :: (a -> b) -> ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m b #

(<$) :: a -> ReinterpretSimpleC e new m b -> ReinterpretSimpleC e new m a #

MonadFix m => MonadFix (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mfix :: (a -> ReinterpretSimpleC e new m a) -> ReinterpretSimpleC e new m a #

MonadFail m => MonadFail (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

fail :: String -> ReinterpretSimpleC e new m a #

Applicative m => Applicative (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

pure :: a -> ReinterpretSimpleC e new m a #

(<*>) :: ReinterpretSimpleC e new m (a -> b) -> ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m b #

liftA2 :: (a -> b -> c) -> ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m b -> ReinterpretSimpleC e new m c #

(*>) :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m b -> ReinterpretSimpleC e new m b #

(<*) :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m b -> ReinterpretSimpleC e new m a #

MonadIO m => MonadIO (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

liftIO :: IO a -> ReinterpretSimpleC e new m a #

Alternative m => Alternative (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

empty :: ReinterpretSimpleC e new m a #

(<|>) :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m a #

some :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m [a] #

many :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m [a] #

MonadPlus m => MonadPlus (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mzero :: ReinterpretSimpleC e new m a #

mplus :: ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m a #

MonadThrow m => MonadThrow (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

throwM :: Exception e0 => e0 -> ReinterpretSimpleC e new m a #

MonadCatch m => MonadCatch (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => ReinterpretSimpleC e new m a -> (e0 -> ReinterpretSimpleC e new m a) -> ReinterpretSimpleC e new m a #

MonadMask m => MonadMask (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

mask :: ((forall a. ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m a) -> ReinterpretSimpleC e new m b) -> ReinterpretSimpleC e new m b #

uninterruptibleMask :: ((forall a. ReinterpretSimpleC e new m a -> ReinterpretSimpleC e new m a) -> ReinterpretSimpleC e new m b) -> ReinterpretSimpleC e new m b #

generalBracket :: ReinterpretSimpleC e new m a -> (a -> ExitCase b -> ReinterpretSimpleC e new m c) -> (a -> ReinterpretSimpleC e new m b) -> ReinterpretSimpleC e new m (b, c) #

(Threads (ReaderT (ReifiedHandler e m)) (Prims m), RepresentationalEff e, KnownList new, HeadEffs new m, Carrier m) => Carrier (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Associated Types

type Derivs (ReinterpretSimpleC e new m) :: [Effect] Source #

type Prims (ReinterpretSimpleC e new m) :: [Effect] Source #

type Derivs (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type Prims (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StM (ReinterpretSimpleC e new m) a Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

type StM (ReinterpretSimpleC e new m) a = StM (IntroC '[e] new (InterpretSimpleC e m)) a

reinterpretSimple :: forall e new m a p. (RepresentationalEff e, KnownList new, HeadEffs new m, Threaders '[ReaderThreads] m p) => EffHandler e m -> ReinterpretSimpleC e new m a -> m a Source #

Reinterpret an effect in terms of newly introduced effects.

This combines interpretSimple and introUnder in order to introduce the effects new under e, which you then may make use of inside the handler for e.

Derivs (ReinterpretSimpleC e new m) = e ': StripPrefix new (Derivs m)
Prims  (ReinterpretSimpleC e new m) = Prims m

This is a significantly slower variant of reinterpret that doesn't have a higher-ranked type, making it much easier to use partially applied.