model-0.3: Derive a model of a data type using Generics

Safe HaskellSafe
LanguageHaskell2010

Data.Model.Util

Synopsis

Documentation

mutualGroups :: (Ord r, Show r, Foldable t) => (a -> Maybe r) -> Map r (t a) -> [[r]] Source #

Return the groups of entities that are mutually dependent

>>> mutualGroups Just (M.fromList [("a",["b","c"]),("b",["a","c"]),("c",[])])
[["c"],["a","b"]]

transitiveClosure :: (Ord r, Show r, Foldable t) => (a -> Maybe r) -> Map r (t a) -> r -> Either Errors [r] Source #

Return the transitive closure of an element in a graph of dependencies specified as an adjacency list

>>> transitiveClosure Just (M.fromList [("a",["b","c"]),("b",["b","d","d","c"]),("c",[]),("d",["a"])]) "b"
Right ["c","a","d","b"]

type Errors = [String] Source #

A list of error messages