HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulepolysemy-1.9.2.0Haskell2010

Polysemy.Membership

  • 1 type
  • 1 class
  • 6 values
  • Packagepolysemy-1.9.2.0
  • Exports10
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceUnion.hs

Witnesses

5 declarations
newtypenewtype ElemOf (e :: k) (r :: [k])
#

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.

patternpattern Here :: () => r ~ (e ': r') => ElemOf e r
#
valuesameMember :: ElemOf e r -> ElemOf e' r -> Maybe (e :~: e')
#

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.

Checking membership

2 declarations
classclass KnownRow (r :: [k]) where
#

A class for effect rows whose elements are inspectable.

This constraint is eventually satisfied as r is instantied to a monomorphic list. (E.g when r becomes something like '[State Int, Output String, Embed IO])

Instances2KnownRow
  • KnownRow '[]Defined in polysemy-1.9.2.0 · Polysemy.Internal.Union
  • (Typeable e, KnownRow r) => KnownRow (e ': r)Defined in polysemy-1.9.2.0 · Polysemy.Internal.Union

Using membership

3 declarations
valueinterceptUsing
  1. :: FirstOrder e "interceptUsing"
  2. => ElemOf e r

    A proof that the handled effect exists in r. This can be retrieved through membership or tryMembership.

  3. -> (forall x (rInitial :: EffectRow). e (Sem rInitial) x -> Sem r x)

    A natural transformation from the handled effect to other effects already in Sem.

  4. -> Sem r a

    Unlike interpret, intercept does not consume any effects.

  5. -> Sem r a
#

A 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.

valueinterceptUsingH
  1. :: ElemOf e r

    A proof that the handled effect exists in r. This can be retrieved through membership or tryMembership.

  2. -> (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.

  3. -> Sem r a

    Unlike interpretH, interceptUsingH does not consume any effects.

  4. -> Sem r a
#

A 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.