effin-0.1.0.0: A Typeable-free implementation of extensible effects

Safe HaskellNone
LanguageHaskell2010

Control.Effect.Coroutine

Synopsis

Documentation

type EffectCoroutine i o es = (Member (Coroutine i o) es, `(i, o)` ~ CoroutineType es) Source

data Coroutine i o a Source

An effect describing a suspendable computation.

Instances

data Iterator i o es a Source

A suspended computation.

Constructors

Done a

Describes a finished computation.

Next (o -> Effect es (Iterator i o es a)) i

Describes a computation that provided a value of type i and awaits a value of type o.

runCoroutine :: Effect (Coroutine i o : es) a -> Effect es (Iterator i o es a) Source

Converts a Coroutine effect into an Iterator.

suspend :: EffectCoroutine i o es => i -> Effect es o Source

Suspends the current computation by providing a value of type i and then waiting for a value of type o.