A proof that e is an element of r.
Due to technical reasons, ElemOf e r is not powerful enough to
prove Member e r; however, it can still be used send actions of e
into r by using subsumeUsing.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Modulepolysemy-1.9.2.0Haskell2010
A proof that e is an element of r.
Due to technical reasons, ElemOf e r is not powerful enough to
prove Member e r; however, it can still be used send actions of e
into r by using subsumeUsing.
Given Member e r, extract a proof that e is an element of r.
Checks if two membership proofs are equal. If they are, then that means that the effects for which membership is proven must also be equal.
Extracts a proof that e is an element of r if that
is indeed the case; otherwise returns Nothing.
Interprets an effect in terms of another identical effect, given an
explicit proof that the effect exists in r.
This is useful in conjunction with tryMembership in order to conditionally make use of effects. For example:
tryListen :: KnownRow r => Sem r a -> Maybe (Sem r ([Int], a))
tryListen m = case tryMembership @(Writer [Int]) of
Just pr -> Just $ subsumeUsing pr (listen (raise m))
_ -> Nothing
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.