extensible-effects-1.11.1.0: An Alternative to Monad Transformers

Safe HaskellSafe
LanguageHaskell2010

Control.Eff.Coroutine

Description

Coroutines implemented with extensible effects

Synopsis

Documentation

data Yield a v Source #

The yield request: reporting a value of type e and suspending the coroutine. For readability, a coroutine accepts a unit to produce its value.

Constructors

Yield a (() -> v) 

Instances

Functor (Yield a) Source # 

Methods

fmap :: (a -> b) -> Yield a a -> Yield a b #

(<$) :: a -> Yield a b -> Yield a a #

yield :: (Typeable a, Member (Yield a) r) => a -> Eff r () Source #

Yield a value of type a and suspend the coroutine.

runC :: Typeable a => Eff (Yield a :> r) w -> Eff r (Y r a w) Source #

Launch a thread and report its status.

data Y r a w Source #

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

Y a (() -> Eff r (Y r a w)) 
Done w