| Safe Haskell | None |
|---|
LogicGrowsOnTrees.Workload
Description
This module contains infrastructure for working with Workloads, which
describe a portion of work to be performed by a worker.
- data Workload = Workload {}
- entire_workload :: Workload
- workloadDepth :: Workload -> Int
- exploreTreeWithinWorkload :: Monoid α => Workload -> Tree α -> α
- exploreTreeTWithinWorkload :: (Monad m, Monoid α) => Workload -> TreeT m α -> m α
- exploreTreeUntilFirstWithinWorkload :: Workload -> Tree α -> Maybe α
- exploreTreeTUntilFirstWithinWorkload :: Monad m => Workload -> TreeT m α -> m (Maybe α)
- exploreTreeUntilFoundWithinWorkload :: Monoid α => (α -> Bool) -> Workload -> Tree α -> (α, Bool)
- exploreTreeTUntilFoundWithinWorkload :: (Monoid α, Monad m) => (α -> Bool) -> Workload -> TreeT m α -> m (α, Bool)
Workload type and simple functions
A Workload describes a portion of work to be performed by a worker; it
consists of a Path to the subtree where the workload is located paired
with a Checkpoint that indicates which parts of that subtree have already
been explored.
Constructors
| Workload | |
Fields | |
Instances
| Eq Workload | |
| Ord Workload | Workloads are ordered first by their depth (the length of the |
| Show Workload | |
| Serialize Workload |
entire_workload :: WorkloadSource
A Workload that consists of the entire tree.
workloadDepth :: Workload -> IntSource
The depth of the workload, equal to the length of the Path component.
Exploration functions
The functions in this section explore the part of a tree that is given by a
Workload.
exploreTreeWithinWorkload :: Monoid α => Workload -> Tree α -> αSource
Explores the nodes in a pure tree given by a Workload, and sums
over all the results in the leaves.
exploreTreeTWithinWorkload :: (Monad m, Monoid α) => Workload -> TreeT m α -> m αSource
Same as exploreTreeWithinWorkload but for an impure tree.
exploreTreeUntilFirstWithinWorkload :: Workload -> Tree α -> Maybe αSource
exploreTreeTUntilFirstWithinWorkload :: Monad m => Workload -> TreeT m α -> m (Maybe α)Source
Same as exploreTreeUntilFirstWithinWorkload but for an impure tree.
exploreTreeUntilFoundWithinWorkload :: Monoid α => (α -> Bool) -> Workload -> Tree α -> (α, Bool)Source
Explores the nodes in a pure tree given by a Workload, summing
all results encountered (i.e., in the leaves) until the current partial sum
satisfies the condition provided by the first parameter.
See exploreTreeUntilFound for more details.
exploreTreeTUntilFoundWithinWorkload :: (Monoid α, Monad m) => (α -> Bool) -> Workload -> TreeT m α -> m (α, Bool)Source
Same as exploreTreeUntilFoundWithinWorkload but for an impure tree.