| Copyright | (c) 2012-2016 Ian-Woo Kim | 
|---|---|
| License | BSD3 | 
| Maintainer | Ian-Woo Kim <ianwookim@gmail.com> | 
| Stability | experimental | 
| Portability | GHC | 
| Safe Haskell | Safe | 
| Language | Haskell98 | 
Control.Monad.Trans.Crtn
Description
definition of coroutine
- data Yld o x = Yld o x
 - type GenT o = FreeT (Yld o)
 - yield :: Monad m => o -> GenT o m ()
 - newtype Awt a x = Awt (a -> x)
 - type CnsmT a = FreeT (Awt a)
 - await :: Monad m => CnsmT a m a
 - data Rqst req ans x = Rqst req (ans -> x)
 - type CrtnT req ans = FreeT (Rqst req ans)
 - request :: Monad m => req -> CrtnT req ans m ans
 - type SrvT req ans m = ReaderT req (CrtnT ans req m)
 - type CliT req ans = CrtnT req ans
 - data CrtnErr
 - (<==|) :: Monad m => SrvT req ans m r' -> CliT req ans m r -> m (Either CrtnErr (SrvT req ans m r', r))
 - mapStateDown :: (Monad m, Functor f) => s -> FreeT f (StateT s m) a -> FreeT f m a
 
Documentation
type GenT o = FreeT (Yld o) Source
Generator type is single-sided coroutine which only gives an output without getting any request.
await command functor for consumer coroutine
Constructors
| Awt (a -> x) | 
type CnsmT a = FreeT (Awt a) Source
Consumer type is a single-sided coroutine which only gets an input without producing output.
command functor of general bidirectional coroutine
Constructors
| Rqst req (ans -> x) | 
type CliT req ans = CrtnT req ans Source
Coroutine type is regarded as a Client type which can be paired with Server type with opposite request and answer type.
type for coroutine status after execution
Constructors
| ServerFinished | |
| Other String |