module Data.Graph.DAG
( module Data.Graph.DAG.Edge
, module Data.Graph.DAG.Edge.Utils
, DAG (..)
, glookup
) where
import Data.Graph.DAG.Edge
import Data.Graph.DAG.Edge.Utils
import Data.List (lookup)
import Data.Singletons
import Data.Proxy
data DAG es a = forall x unique. GNil (EdgeSchema es x unique)
| GCons String a (DAG es a)
instance Functor (DAG es) where
fmap f (GNil e) = GNil e
fmap f (GCons k x xs) = GCons k (f x) $
fmap f xs
glookup :: String -> DAG es a -> Maybe a
glookup _ (GNil _) = Nothing
glookup k (GCons k2 a gs) | k == k2 = Just a
| otherwise = glookup k gs
espanningtrees :: SingI (SpanningTrees' es '[]) =>
EdgeSchema es x unique
-> Demote (SpanningTrees' es '[])
espanningtrees = reflect . getSpanningTrees