Safe Haskell | Safe-Inferred |
---|
- data TaskIO r a
- runTaskIO :: TaskIO r (Maybe r) -> (IO (Maybe r) -> IO ()) -> IO (Maybe r)
- addTaskIO :: TaskIO r (Maybe r) -> TaskIO r ()
- data Interruptible r
- = NoResult
- | OneResult r
- | AddInterruptibles [Interruptible r]
- runInterrupted :: Interruptible r -> TaskIO r (Maybe r)
- runInterruptible :: Interruptible r -> TaskIO r (Maybe r)
Documentation
A monad in which tasks can be specified.
Task is instancing MonadIO
and it therefore has the function liftIO
to
perform arbitrary IO actions. Tasks may or may not return a value. If it
returns a value, this value is written back as a result.
Additionally there is a function addTask
to
add new tasks to the bag.
The parameter r is the result type of the corresponding bag.
In contrast to Interruptible
the evaluation order is simililar to that of
the IO monad and tasks added by addTaskIO are added immediately.
addTaskIO :: TaskIO r (Maybe r) -> TaskIO r ()Source
Add a task to the bag of tasks. The task will be added immediately.
data Interruptible r Source
A type to specify interruptible tasks. Interruptible tasks are tasks that
can be interrupted and resumed later. Basically this means that the
evaluating thread may be killed in between. Side-effects in this code are
not allowed, and therefore all interrupted tasks have to be pure
functional in contrast to TaskIO
tasks. Otherwise this is similar to
TaskIO
.
runInterrupted :: Interruptible r -> TaskIO r (Maybe r)Source
runInterruptible :: Interruptible r -> TaskIO r (Maybe r)Source