interpret The simplest way to produce an effect handler. Interprets an effect e by
transforming it into other effects inside of r.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulepolysemy-1.9.2.0Haskell2010
interpret The simplest way to produce an effect handler. Interprets an effect e by
transforming it into other effects inside of r.
intercept Like interpret, but instead of handling the effect, allows responding to the effect while leaving it unhandled. This allows you, for example, to intercept other effects and insert logic around them.
reinterpret Like interpret, but instead of removing the effect e, reencodes it in
some new effect f. This function will fuse when followed by
runState, meaning it's free to reinterpret in terms of
the State effect and immediately run it.
reinterpret2 Like reinterpret, but introduces two intermediary effects.
reinterpret3 Like reinterpret, but introduces three intermediary effects.
Rewrite an effect e1 directly into e2, and put it on the top of the
effect stack.
Transform an effect e1 into an effect e2 that is already somewhere
inside of the stack.
interpretH interceptH :: Member e r=> (forall x (rInitial :: EffectRow). e (Sem rInitial) x -> Tactical e (Sem rInitial) r x)A natural transformation from the handled effect to other effects already in Sem.
-> Sem r aUnlike interpretH, interceptH does not consume any effects.
-> Sem r areinterpretH Like reinterpret, but for higher-order effects.
See the notes on Tactical for how to use this function.
reinterpret2H Like reinterpret2, but for higher-order effects.
See the notes on Tactical for how to use this function.
reinterpret3H Like reinterpret3, but for higher-order effects.
See the notes on Tactical for how to use this function.
Interpret an effect e through a natural transformation from Weaving e
to Sem r
interceptUsing :: FirstOrder e "interceptUsing"
=> ElemOf e rA proof that the handled effect exists in r.
This can be retrieved through membership or
tryMembership.
-> (forall x (rInitial :: EffectRow). e (Sem rInitial) x -> Sem r x)A natural transformation from the handled effect to other effects already in Sem.
-> Sem r a-> Sem r aA variant of intercept that accepts an explicit proof that the effect is in the effect stack rather then requiring a Member constraint.
This is useful in conjunction with tryMembership in order to conditionally perform intercept.
interceptUsingH :: ElemOf e rA proof that the handled effect exists in r.
This can be retrieved through membership or
tryMembership.
-> (forall x (rInitial :: EffectRow). e (Sem rInitial) x -> Tactical e (Sem rInitial) r x)A natural transformation from the handled effect to other effects already in Sem.
-> Sem r aUnlike interpretH, interceptUsingH does not consume any effects.
-> Sem r aA variant of interceptH that accepts an explicit proof that the effect is in the effect stack rather then requiring a Member constraint.
This is useful in conjunction with tryMembership in order to conditionally perform interceptH.
See the notes on Tactical for how to use this function.
Like interpret, but with access to an intermediate state s.
Like interpret, but with access to an intermediate state s.