monad-coroutine-0.5: Coroutine monad transformer for suspending and resuming monadic computationsSource codeContentsIndex
Control.Monad.Coroutine.SuspensionFunctors
Contents
Suspension functors
Description
This module defines suspension functors for use with the Control.Monad.Coroutine module.
Synopsis
data Yield x y = Yield x y
newtype Await x y = Await (x -> y)
data Request request response x = Request request (response -> x)
data EitherFunctor l r x
= LeftF (l x)
| RightF (r x)
yield :: Monad m => x -> Coroutine (Yield x) m ()
await :: Monad m => Coroutine (Await x) m x
request :: Monad m => x -> Coroutine (Request x y) m y
Suspension functors
data Yield x y Source
The Yield functor instance is equivalent to (,) but more descriptive.
Constructors
Yield x y
show/hide Instances
newtype Await x y Source
The Await functor instance is equivalent to (->) but more descriptive.
Constructors
Await (x -> y)
show/hide Instances
data Request request response x Source
The Request functor instance combines a Yield of a request with an Await for a response.
Constructors
Request request (response -> x)
show/hide Instances
data EitherFunctor l r x Source
Combines two alternative functors into one, applying one or the other. Used for nested coroutines.
Constructors
LeftF (l x)
RightF (r x)
show/hide Instances
(Functor l, Functor r) => Functor (EitherFunctor l r)
(Functor p, Functor s) => ChildFunctor (EitherFunctor p s)
yield :: Monad m => x -> Coroutine (Yield x) m ()Source
Suspend yielding a value.
await :: Monad m => Coroutine (Await x) m xSource
Suspend until a value is provided.
request :: Monad m => x -> Coroutine (Request x y) m ySource
Suspend yielding a request and awaiting the response.
Produced by Haddock version 2.7.2