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-zoo-0.8.2.0Haskell2010

Polysemy.Capture

  • 2 types
  • 7 values

Effect

1 declaration
datadata Capture (ref :: Type -> Type -> Type) (m :: Type -> Type) a where
#

A less powerful variant of Polysemy.Shift.Shift that may always be interpreted safely. Unlike Polysemy.Shift.Shift, continuations can't leave the scope in which they are provided.

Note: Any computation used in a higher-order effect will be delimited.

Activating polysemy-plugin is highly recommended when using this effect in order to avoid ambiguous types.

Constructors

Actions

5 declarations
valuereify :: Member (Capture ref) r => (forall s. ref s a -> Sem r s) -> Sem r a
#

Reifies the current continuation in the form of a prompt, and passes it to the first argument.

valuereflect :: Member (Capture ref) r => ref s a -> a -> Sem r s
#

Provide an answer to a prompt, jumping to its reified continuation. This will not abort the current continuation, and the reified computation will return its final result when finished.

The provided continuation may fail locally in its subcontinuations. It may sometimes become necessary to handle such cases. To do so, use delimit' together with reflect (the reified continuation is already delimited).

valuecapture
  1. :: Member (Capture ref) r
  2. => forall s. (a -> Sem r s) -> Sem r s
  3. -> Sem r a
#

A restricted version of shift. Executing the provided continuation will not abort execution.

The provided continuation may fail locally in its subcontinuations. It may sometimes become necessary to handle such cases, in which case such failure may be detected by using delimit' together with the provided continuation (the provided continuation is already delimited).

Interpretations

2 declarations

Prompt types

1 declaration
newtypenewtype Ref (m :: k -> Type) (s :: k) a
#

Constructors

Instances1Contravariant
  • Contravariant (Ref m s)Defined in polysemy-zoo-0.8.2.0 · Polysemy.Cont.Internal