Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Build.Trace
Description
Build traces that are used for recording information from previuos builds.
Synopsis
- data Trace k v r = Trace {}
- data VT k v
- recordVT :: k -> Hash v -> [(k, Hash v)] -> VT k v -> VT k v
- verifyVT :: (Monad m, Eq k, Eq v) => k -> Hash v -> (k -> m (Hash v)) -> VT k v -> m Bool
- data CT k v
- isDirtyCT :: (Eq k, Hashable v) => k -> Store (CT k v) k v -> Bool
- recordCT :: k -> v -> [(k, Hash v)] -> CT k v -> CT k v
- constructCT :: (Monad m, Eq k, Eq v) => k -> (k -> m (Hash v)) -> CT k v -> m [v]
- data DCT k v
- recordDCT :: forall k v m. (Eq k, Hashable v, Monad m) => k -> v -> [k] -> (k -> m (Hash v)) -> DCT k v -> m (DCT k v)
- constructDCT :: forall k v m. (Eq k, Hashable v, Monad m) => k -> (k -> m (Hash v)) -> DCT k v -> m [v]
- data Step
- data ST k v
- recordST :: (Hashable v, Eq k) => Step -> k -> v -> [k] -> ST k v -> ST k v
- verifyST :: (Monad m, Eq k, Hashable v) => k -> v -> (k -> m ()) -> m (ST k v) -> m Bool
Documentation
A trace is parameterised by the types of keys k
, hashes h
, as well as the
result r
. For verifying traces, r = h
; for constructive traces, Hash r = h
.
Verifying traces
An abstract data type for a set of verifying traces equipped with recordVT
,
verifyVT
and a Monoid
instance.
recordVT :: k -> Hash v -> [(k, Hash v)] -> VT k v -> VT k v Source #
Record a new trace for building a key
with dependencies deps
, obtaining
the hashes of up-to-date values by using fetchHash
.
verifyVT :: (Monad m, Eq k, Eq v) => k -> Hash v -> (k -> m (Hash v)) -> VT k v -> m Bool Source #
Given a function to compute the hash of a key's current value,
a key
, and a set of verifying traces, return True
if the key
is
up-to-date.
Constructive traces
An abstract data type for a set of constructive traces equipped with
recordCT
, isDirtyCT
, constructCT
and a Monoid
instance.
isDirtyCT :: (Eq k, Hashable v) => k -> Store (CT k v) k v -> Bool Source #
Check if a given key
is dirty w.r.t a store
.
recordCT :: k -> v -> [(k, Hash v)] -> CT k v -> CT k v Source #
Record a new trace for building a key
with dependencies deps
, obtaining
the hashes of up-to-date values by using fetchHash
.
constructCT :: (Monad m, Eq k, Eq v) => k -> (k -> m (Hash v)) -> CT k v -> m [v] Source #
Given a function to compute the hash of a key's current value,
a key
, and a set of constructive traces, return Just newValue
if it is
possible to reconstruct it from the traces. Prefer reconstructing the
currenct value, if it matches one of the traces.
Constructive traces optimised for deep tasks
Our current model has the same representation as CT
, but requires an
additional invariant: if a DCT contains a trace for a key k
, then it must
also contain traces for each of its non-input dependencies.
recordDCT :: forall k v m. (Eq k, Hashable v, Monad m) => k -> v -> [k] -> (k -> m (Hash v)) -> DCT k v -> m (DCT k v) Source #
Record a new trace for building a key
with dependencies deps
, obtaining
the hashes of up-to-date values from the given store
.
constructDCT :: forall k v m. (Eq k, Hashable v, Monad m) => k -> (k -> m (Hash v)) -> DCT k v -> m [v] Source #
Given a function to compute the hash of a key's current value,
a key
, and a set of deep constructive traces, return
Just newValue
if it is possible to reconstruct it from the traces.
Step traces
A step trace, records the resulting value, the step it last build, the step where it changed.