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.Shift.Internal

  • 1 type
  • 6 values
datadata Shift (ref :: Type -> Type) s (m :: Type -> Type) a where
#

An effect for delimited continuations, formulated algebraically through a variant of the 'Polysemy.Cont.Jump/Polysemy.Cont.Subst formulation of abortive continuations.

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

Constructors

valuetrap :: Member (Shift ref s) r => (ref a -> Sem r s) -> Sem r a
#

Reifies the current continuation in the form of a prompt, and passes it to the first argument. Unlike subst, control will never return to the current continuation unless the prompt is invoked via release.

valueinvoke :: Member (Shift ref s) r => ref a -> a -> Sem r s
#

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

Any effectful state of effects which have been run before the interpreter for Shift will be embedded in the return value, and therefore the invocation won't have any apparent effects unless these are interpreted in the final monad.

Any higher-order actions will also not interact with the continuation in any meaningful way; i.e. local or censor does not affect it, catch will fail to catch any of its exceptions, and listen will always return mempty.

The provided continuation may fail locally in its subcontinuations. It may sometimes become necessary to handle such cases. To do so, use 'reset'' together with release.

valueabort :: Member (Shift ref s) r => s -> Sem r a
#

Aborts the current continuation with a result.

valuereset' :: Member (Shift ref s) r => Sem r s -> Sem r (Maybe s)
#

Delimits any continuations and calls to abort, and detects if any subcontinuation has failed locally.