monad-task-0.1.0: A monad transformer that turns event processing into co-routine programming.

Safe HaskellNone




Task monad transformer

newtype TaskT e m a Source

Task monad transformer.




runTaskT :: ContT (Trace m e) m a


MonadReader s m => MonadReader s (TaskT e m) 
MonadState s m => MonadState s (TaskT e m) 
Monad m => MonadTask e (TaskT e m) 
MonadTrans (TaskT e) 
Monad m => Monad (TaskT e m) 
Functor (TaskT e m) 
Applicative (TaskT e m) 
MonadIO m => MonadIO (TaskT e m) 

Trace of a base monad

data Trace m e whereSource

A Trace m e represents the control flow of a mult-threaded task monad defined over a base monad m and event type e.


EXIT :: Trace m e 
RET :: Trace m e 
YIELD :: m (Trace m e) -> Trace m e 
FORK :: m (Trace m e) -> m (Trace m e) -> Trace m e 
WATCH :: (e -> Maybe v) -> (v -> m (Trace m e)) -> Trace m e 
SIGNAL :: e -> m (Trace m e) -> Trace m e 

runTrace :: Monad m => m (Trace m e) -> m ()Source

runTrace runs a trace to its completion in the base monad with a simple round-robin scheduler.

Task functions

taskToTrace :: Monad m => TaskT e m a -> m (Trace m e)Source

tasktoTrace CPS-converts a task monad into a trace in its base monad.

runTask :: Monad m => TaskT e m a -> m ()Source

runTask runs a task monad until to its completion, i.e., no more active tasks to run, or until it exits.