build-0.0.1.1: Build systems a la carte

Safe HaskellNone
LanguageHaskell2010

Build.Trace

Contents

Description

Build traces that are used for recording information from previuos builds.

Synopsis

Documentation

data Trace k h r Source #

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.

Constructors

Trace 

Fields

Instances

(Show r, Show h, Show k) => Show (Trace k h r) Source # 

Methods

showsPrec :: Int -> Trace k h r -> ShowS #

show :: Trace k h r -> String #

showList :: [Trace k h r] -> ShowS #

Verifying traces

data VT k v Source #

An abstract data type for a set of verifying traces equipped with recordVT, verifyVT and a Monoid instance.

Instances

Semigroup (VT k v) Source # 

Methods

(<>) :: VT k v -> VT k v -> VT k v #

sconcat :: NonEmpty (VT k v) -> VT k v #

stimes :: Integral b => b -> VT k v -> VT k v #

Monoid (VT k v) Source # 

Methods

mempty :: VT k v #

mappend :: VT k v -> VT k v -> VT k v #

mconcat :: [VT k v] -> VT k v #

recordVT :: (Hashable v, Monad m) => k -> v -> [k] -> (k -> m (Hash v)) -> VT k v -> m (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, Hashable v) => k -> 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

data CT k v Source #

An abstract data type for a set of constructive traces equipped with recordCT, isDirtyCT, constructCT and a Monoid instance.

Instances

(Show k, Show v) => Show (CT k v) Source # 

Methods

showsPrec :: Int -> CT k v -> ShowS #

show :: CT k v -> String #

showList :: [CT k v] -> ShowS #

Semigroup (CT k v) Source # 

Methods

(<>) :: CT k v -> CT k v -> CT k v #

sconcat :: NonEmpty (CT k v) -> CT k v #

stimes :: Integral b => b -> CT k v -> CT k v #

Monoid (CT k v) Source # 

Methods

mempty :: CT k v #

mappend :: CT k v -> CT k v -> CT k v #

mconcat :: [CT k v] -> CT k v #

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 :: Monad m => k -> v -> [k] -> (k -> m (Hash v)) -> CT k v -> m (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 -> v -> (k -> m (Hash v)) -> CT k v -> m (Maybe 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 deterministic tasks

data DCT k v Source #

Invariant: if a DCT contains a trace for a key k, then it must also contain traces for each of its non-input dependencies. Input keys cannot appear in a DCT because they are never built.

Instances

Semigroup (DCT k v) Source # 

Methods

(<>) :: DCT k v -> DCT k v -> DCT k v #

sconcat :: NonEmpty (DCT k v) -> DCT k v #

stimes :: Integral b => b -> DCT k v -> DCT k v #

Monoid (DCT k v) Source # 

Methods

mempty :: DCT k v #

mappend :: DCT k v -> DCT k v -> DCT k v #

mconcat :: [DCT k v] -> DCT k v #

recordDCT :: forall k v m. (Hashable 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. (Hashable k, Hashable v, Monad m) => k -> (k -> m (Hash v)) -> DCT k v -> m (Maybe v) Source #

Given a function to compute the hash of a key's current value, a key, and a set of deterministic constructive traces, return Just newValue if it is possible to reconstruct it from the traces.

Step traces

data Step Source #

Instances

Enum Step Source # 

Methods

succ :: Step -> Step #

pred :: Step -> Step #

toEnum :: Int -> Step #

fromEnum :: Step -> Int #

enumFrom :: Step -> [Step] #

enumFromThen :: Step -> Step -> [Step] #

enumFromTo :: Step -> Step -> [Step] #

enumFromThenTo :: Step -> Step -> Step -> [Step] #

Eq Step Source # 

Methods

(==) :: Step -> Step -> Bool #

(/=) :: Step -> Step -> Bool #

Ord Step Source # 

Methods

compare :: Step -> Step -> Ordering #

(<) :: Step -> Step -> Bool #

(<=) :: Step -> Step -> Bool #

(>) :: Step -> Step -> Bool #

(>=) :: Step -> Step -> Bool #

max :: Step -> Step -> Step #

min :: Step -> Step -> Step #

Show Step Source # 

Methods

showsPrec :: Int -> Step -> ShowS #

show :: Step -> String #

showList :: [Step] -> ShowS #

Semigroup Step Source # 

Methods

(<>) :: Step -> Step -> Step #

sconcat :: NonEmpty Step -> Step #

stimes :: Integral b => b -> Step -> Step #

Monoid Step Source # 

Methods

mempty :: Step #

mappend :: Step -> Step -> Step #

mconcat :: [Step] -> Step #

data ST k v Source #

A step trace, records the resulting value, the step it last build, the step where it changed.

Instances

(Show k, Show v) => Show (ST k v) Source # 

Methods

showsPrec :: Int -> ST k v -> ShowS #

show :: ST k v -> String #

showList :: [ST k v] -> ShowS #

Semigroup (ST k v) Source # 

Methods

(<>) :: ST k v -> ST k v -> ST k v #

sconcat :: NonEmpty (ST k v) -> ST k v #

stimes :: Integral b => b -> ST k v -> ST k v #

Monoid (ST k v) Source # 

Methods

mempty :: ST k v #

mappend :: ST k v -> ST k v -> ST k v #

mconcat :: [ST k v] -> ST k v #

recordST :: (Hashable v, Eq k, Monad m) => Step -> k -> v -> [k] -> ST k v -> m (ST k v) Source #

Record a new trace for building a key with dependencies deps.

verifyST :: (Monad m, Eq k, Hashable v) => k -> v -> (k -> m ()) -> m (ST 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.