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

Safe HaskellNone
LanguageHaskell2010

Control.Effect.Coroutine

Synopsis

Documentation

class MemberEffect Coroutine (Coroutine i o) es => EffectCoroutine i o es Source

Instances

MemberEffect (* -> * -> * -> *) Coroutine (Coroutine i o) es => EffectCoroutine i o es 

data Coroutine i o a Source

An effect describing a suspendable computation.

Instances

Functor (Coroutine i o) 
type Is (* -> * -> * -> *) Coroutine f 

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.

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.

evalIterator :: Iterator i o es a -> [o] -> Effect es (Iterator i o es a, [i]) Source

Evaluates an iterator by providing it with an input stream.