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

Safe HaskellNone
LanguageHaskell2010

Control.Effect.Coroutine

Synopsis

Documentation

class MemberEffect Coroutine (Coroutine i o) l => EffectCoroutine i o l

Instances

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

data Coroutine i o a

An effect describing a suspendable computation.

Instances

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

runCoroutine :: Effect (Coroutine i o :+ l) a -> Effect l (Iterator i o l a)

Converts a Coroutine effect into an Iterator.

suspend :: EffectCoroutine i o l => i -> Effect l o

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

data Iterator i o l a

A suspended computation.

Constructors

Done a

Describes a finished computation.

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

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

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

Evaluates an iterator by providing it with an input stream.