deptrack-core-0.1.0.0: DepTrack Core types and model.

Safe HaskellSafe
LanguageHaskell2010

DepTrack

Synopsis

Documentation

type DepTrackT a m = WriterT (DList (DepCrumb a)) m Source #

track :: Monad m => (b -> a) -> DepTrackT a m b -> DepTrackT a m b Source #

Nests a computation within annotation to record the result of the computation as a dependencies.

The computation to annotate is the second parameter.

declare :: Monad m => a -> DepTrackT a m b -> DepTrackT a m b Source #

Declare the dependencies of a given computation.

class ToDep a b where Source #

Convenience typeclass to decouple the definition of projection functions to dependency nodes.

This typeclass allows to write dep-recording code once and specialize the type of node by only switching the parameter.

Minimal complete definition

toDep

Methods

toDep :: a -> b Source #

dep :: (ToDep a b, Monad m) => DepTrackT b m a -> DepTrackT b m a Source #

Like track but using the projection function resolved from the ToDep typeclass.

evalDeps :: DepTrackT a m b -> m (b, DList (DepCrumb a)) Source #

Evaluates a computation, tracking dependencies as a sequence of dependency-tracking actions (crumbs).

value :: Monad m => DepTrackT a m b -> m b Source #

Evaluates a computation, dropping the trace of dependencies.

evalDepForest :: (Monad m, Show a) => DepTrackT a m b -> m (b, Either ParseError (Forest a)) Source #

Evaluates a computation, tracking dependencies as a forest.

evalDepGraph Source #

Arguments

:: (Monad m, Ord k, Show a) 
=> DepTrackT a m b

The dependency tracked computation

-> (a -> k)

How to get a key from a node's data

-> m (b, Either ParseError (GraphData a k)) 

Evaluates a computation, tracking dependencies as a graph with an auxilliary function.

Node identity is determined using a projection function.

evalDepForest1 :: (Monad m, Show a) => DepTrackT a m b -> m (b, Forest a) Source #

Evaluates a computation, tracking dependencies as a forest.

type GraphData a k = (Graph, Vertex -> (a, k, [k]), k -> Maybe Vertex) Source #

General type for graphs of computations

evalDepGraph1 :: (Monad m, Ord k, Show a) => DepTrackT a m b -> (a -> k) -> m (b, GraphData a k) Source #

buildGraph :: Ord k => (a -> k) -> Forest a -> GraphData a k Source #

Builds a Graph with auxilliary from nodes in a Forest.

The identity of a node in the forest is given using a key-projection function.

inject :: Monad m => DepTrackT a m b -> DepTrackT a m c -> DepTrackT a m (b, c) Source #

Artificially injects dependencies from a computation to the dependencies of another given computation.

Beware that one can easily create dependency cycles when using inject. This function is however necessary when you have no control over some library code and you want to artificially wrap it with new dependencies.