Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module types and functions for representing a dependency graph of arbitrary objects and functions for querying such graphs to get dependency and reverse dependency information.
- class (Eq a, Ord a) => Dependable a where
- data DependencyGraph a = DG {
- depGraphObjectMap :: [(a, Int)]
- depGraphNameMap :: [(String, Int)]
- depGraph :: Gr String String
- mkDepGraph :: Dependable a => [a] -> Either String (DependencyGraph a)
- dependencies :: Dependable d => DependencyGraph d -> String -> [String]
- reverseDependencies :: Dependable d => DependencyGraph d -> String -> [String]
Documentation
class (Eq a, Ord a) => Dependable a where Source #
Dependable
objects supply a representation of their identifiers,
and a list of other objects upon which they depend.
depsOf :: a -> [String] Source #
The identifiers of the objects on which a
depends.
The identifier of a Dependable
object.
data DependencyGraph a Source #
A DependencyGraph
represents a collection of objects together
with a graph of their dependency relationships. This is intended
to be used with instances of Dependable
.
DG | |
|
Eq a => Eq (DependencyGraph a) Source # | |
Show a => Show (DependencyGraph a) Source # | |
mkDepGraph :: Dependable a => [a] -> Either String (DependencyGraph a) Source #
Build a dependency graph from a list of Dependable
s. Return the
graph on success or return an error message if the graph cannot be
constructed (e.g., if the graph contains a cycle).
dependencies :: Dependable d => DependencyGraph d -> String -> [String] Source #
Given a dependency graph and an ID, return the IDs of objects that the object depends on. IDs are returned with least direct dependencies first (i.e., the apply order).
reverseDependencies :: Dependable d => DependencyGraph d -> String -> [String] Source #
Given a dependency graph and an ID, return the IDs of objects that depend on it. IDs are returned with least direct reverse dependencies first (i.e., the revert order).