Safe Haskell | None |
---|
A tree of computation
- data Tree a
- data Label
- requireAll :: [Tree a] -> Tree a
- requireAny :: [Tree a] -> Tree a
- tryAll :: [Tree a] -> Tree a
- evalTree :: Monoid a => (a -> Bool) -> Tree (Promise a) -> IO (Maybe a)
- watchTree :: Monoid a => (a -> Bool) -> Tree (Promise a) -> IO (DTVar (Tree (PromiseResult a)))
- interleave :: Tree a -> [a]
- showTree :: Show a => Tree a -> String
Trees
Both/Either-trees
Both/Either labels
Creating trees
requireAll :: [Tree a] -> Tree aSource
All of these must succeed
requireAny :: [Tree a] -> Tree aSource
Any of these must succeed
Evaluating trees
watchTree :: Monoid a => (a -> Bool) -> Tree (Promise a) -> IO (DTVar (Tree (PromiseResult a)))Source
Assuming some other thread(s) evaluate the promises in the tree, this gives
a live view of the progress, and cancels unnecessary subtrees (due to Either
).
The first argument is a way to deem promises with results as failures. `(== mempty)` or (const False) could be good alternatives.
Scheduling
interleave :: Tree a -> [a]Source
A simple scheduling (see workers
)