Portability | POSIX |
---|---|
Stability | experimental |
Maintainer | bastianholst@gmx.de |
Safe Haskell | None |
High level bag of tasks interface based on Control.Concurrent.Bag.Concurrent. Tasks can only return results and add new tasks as intended and it is not possible to add new tasks from the outside or from the action processing the results.
- module Control.Concurrent.Bag.Task
- newTaskBag :: BufferType -> [TaskIO r (Maybe r)] -> IO [r]
- newEvalBag :: BufferType -> [r] -> IO [r]
- newInterruptingBag :: BufferType -> [Interruptible r] -> IO [r]
- newInterruptibleBag :: BufferType -> [Interruptible r] -> IO [r]
- data BufferType
Documentation
module Control.Concurrent.Bag.Task
:: BufferType | buffer type |
-> [TaskIO r (Maybe r)] | list of initial tasks |
-> IO [r] | lazy result list |
Build and start a new task bag.
The returned list is not evaluated yet, but will be evaluated on demand later. Already computed results will be kept in a buffer until the result list is evaluated. If the result list gets garbage collected, the bag of tasks will be stopped automatically.
newEvalBag :: BufferType -> [r] -> IO [r]Source
Like newTaskBag
, but it takes a list of expressions that will be
evaluated to weak head normal form using seq
.
__WARNING__: This does not evaluate to normal form, but only to weak head normal form.
:: BufferType | buffer type |
-> [Interruptible r] | list of initial tasks |
-> IO [r] | lazy result list |
Similar to newTaskBag
, but interrupts the tasks in certain intervals.
Using a TChan
as buffer, this ensures
completeness: all tasks that have a result will get their time to evaluate
it. Note, that calculations, that do no memory allocation, cannot be
interrupted.
:: BufferType | buffer type |
-> [Interruptible r] | list of initial tasks |
-> IO [r] | lazy result list |
Similar to newTaskBag
, but taking a list of Interruptible
instead of
tasks.