HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Moduleextensible-effects-5.0.0.1Haskell2010

Control.Eff.Coroutine

Coroutines implemented with extensible effects

  • 2 types
  • 3 values
datadata Yield a (b :: k) (v :: k) where
#

Co-routines The interface is intentionally chosen to be the same as in transf.hs

| The yield request: reporting a value of type e and suspending the coroutine. Resuming with the value of type b

Constructors

Instances1Handle
  • Handle (Yield a b) (Yield a b ': r) w (Eff r (Y r b a))Defined in extensible-effects-5.0.0.1 · Control.Eff.Coroutine

    Given a continuation and a request, respond to it

valueyield :: Member (Yield a b) r => a -> Eff r b
#

Yield a value of type a and suspend the coroutine.

valuerunC :: Eff (Yield a b ': r) w -> Eff r (Y r b a)
#

Launch a thread and report its status

datadata Y (r :: [Type -> Type]) w a
#

Status of a thread: done or reporting the value of the type a (For simplicity, a co-routine reports a value but accepts unit)

Type parameter r is the effect we're yielding from.

Type parameter a is the type that is yielded.

Type parameter w is the type of the value returned from the coroutine when it has completed.

Constructors

Instances1Handle
  • Handle (Yield a b) (Yield a b ': r) w (Eff r (Y r b a))Defined in extensible-effects-5.0.0.1 · Control.Eff.Coroutine

    Given a continuation and a request, respond to it