| Safe Haskell | Safe |
|---|---|
| Language | Haskell98 |
Control.Monad.Task.Class
Contents
Description
The MonadTask class that defines the set of combinators to work with Task monad.
The operations for MonadTask are similar to those of co-routines, with the addition of watching and signaling events.
We also define a set of auto lifting for common transformers. Note that we
purposely leave a case undefined where a state transformer goes on top of
a task monad, because such an operation is either unsound or has to roll
back the state (see ). So it's
recommended to keep TaskT on top of all StateT in a transformer stack.liftCallCC
MonadTask class
class Monad m => MonadTask e m | m -> e where Source #
MonadTask specifies a task monad m over an event type e.
Methods
yield temporarily suspends current task to let others run.
fork spawns a task and runs it immediately until it ends or
suspends before returning to current task.
watch :: (e -> Maybe a) -> m a Source #
watch suspends the current task to wait for future events, and will
resume execution when an event triggers its watching function.
signal broadcasts an event to all other tasks that are watching,
and give those who wake up the priority to run.
exit ends all tasks and returns immediately.
Instances
| (Monad m, MonadTask a m) => MonadTask a (MaybeT m) Source # | |
| (Monad m, MonadTask a m) => MonadTask a (ListT m) Source # | |
| (Monoid w, Monad m, MonadTask a m) => MonadTask a (WriterT w m) Source # | |
| (Monoid w, Monad m, MonadTask a m) => MonadTask a (WriterT w m) Source # | |
| (Monad m, MonadTask a m) => MonadTask a (IdentityT * m) Source # | |
| (Monad m, MonadTask a m) => MonadTask a (ExceptT e m) Source # | |
| Monad m => MonadTask e (TaskT e m) Source # | |
| (Monad m, MonadTask a m) => MonadTask a (ReaderT * r m) Source # | |