Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Build.SelfTracking
Description
This module defines two different strategies of self-tracking, based
around the idea of storing task descriptions that can be parsed into a Task
.
- For
Monad
it works out beautifully. You just store the rule on the disk, and depend on it. - For
Applicative
, we generate a freshTask
each time, but have thatTask
depend on a fake version of the rules. This is a change in theTask
, but it's one for which the standard implementations tend to cope with just fine. Most applicative systems with self-tracking probably do it this way.
Documentation
We assume that the fetch passed to a Task is consistent and returns values matching the keys. It is possible to switch to typed tasks to check this assumption at compile time, e.g. see Build.Task.Typed.
selfTrackingM :: forall k v t. (t -> Task Monad k v) -> Tasks Monad k t -> Tasks Monad (Key k) (Value v t) Source #
A model for Monad
, works beautifully and allows storing the key on disk.
selfTrackingA :: (t -> Task Applicative k v) -> (k -> t) -> Tasks Applicative (Key k) (Value v t) Source #
The applicative model requires every key to be able to associate with its environment (e.g. a reader somewhere). Does not support cutoff if a key changes.