gang-of-threads-3.0.0: Non-deterministic parallelism with bags

Safe HaskellSafe-Inferred

Control.Concurrent.Bag.Task

Synopsis

Documentation

data TaskIO r a Source

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.

Instances

runTaskIO :: TaskIO r (Maybe r) -> (IO (Maybe r) -> IO ()) -> IO (Maybe r)Source

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.