-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | DepTrack Core types and model. -- -- Rather than building and maintaing a dependency tree/graph by hand. -- DepTrack proposes to _track_ dependencies as a side-effect of a -- computation. @package deptrack-core @version 0.1.0.0 module DepTrack.DepCrumb data DepCrumb a Push :: DepCrumb a Pop :: a -> DepCrumb a SpadeIn :: DepCrumb a SpadeMiddle :: DepCrumb a SpadeOut :: DepCrumb a instance GHC.Show.Show a => GHC.Show.Show (DepTrack.DepCrumb.DepCrumb a) instance GHC.Base.Functor DepTrack.DepCrumb.DepCrumb module DepTrack.Parsing -- | Parser to transform a well-formed list of DepCrumb into a Forest of -- dependencies. -- -- The (Show a) requirements exists to be able to display error while -- parsing. dependencies :: (Monad m, Show a) => ParsecT [DepCrumb a] () m (Forest a) module DepTrack type DepTrackT a m = WriterT (DList (DepCrumb a)) m -- | Nests a computation within annotation to record the result of the -- computation as a dependencies. -- -- The computation to annotate is the second parameter. track :: (Monad m) => (b -> a) -> DepTrackT a m b -> DepTrackT a m b -- | Declare the dependencies of a given computation. declare :: (Monad m) => a -> DepTrackT a m b -> DepTrackT a m b -- | 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. class ToDep a b toDep :: ToDep a b => a -> b -- | Like track but using the projection function resolved from the ToDep -- typeclass. dep :: (ToDep a b, Monad m) => DepTrackT b m a -> DepTrackT b m a -- | Evaluates a computation, tracking dependencies as a sequence of -- dependency-tracking actions (crumbs). evalDeps :: DepTrackT a m b -> m (b, DList (DepCrumb a)) -- | Evaluates a computation, dropping the trace of dependencies. value :: (Monad m) => DepTrackT a m b -> m b -- | Evaluates a computation, tracking dependencies as a forest. evalDepForest :: (Monad m, Show a) => DepTrackT a m b -> m (b, Either ParseError (Forest a)) -- | Evaluates a computation, tracking dependencies as a graph with an -- auxilliary function. -- -- Node identity is determined using a projection function. evalDepGraph :: (Monad m, Ord k, Show a) => DepTrackT a m b -> (a -> k) -> m (b, Either ParseError (GraphData a k)) -- | Evaluates a computation, tracking dependencies as a forest. evalDepForest1 :: (Monad m, Show a) => DepTrackT a m b -> m (b, Forest a) -- | General type for graphs of computations type GraphData a k = (Graph, Vertex -> (a, k, [k]), k -> Maybe Vertex) evalDepGraph1 :: (Monad m, Ord k, Show a) => DepTrackT a m b -> (a -> k) -> m (b, GraphData a k) -- | 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. buildGraph :: Ord k => (a -> k) -> Forest a -> GraphData a k -- | 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. inject :: (Monad m) => DepTrackT a m b -> DepTrackT a m c -> DepTrackT a m (b, c)