]> gitweb @ CieloNegro.org - hs-rrdtool.git/blobdiff - Data/HList/Graph.hs
major rename
[hs-rrdtool.git] / Data / HList / Graph.hs
index f31659ca4671b660c95b88b3d4cfae3a21e73e18..7a833ea4ec2e10eadbf9345f1ff575825610a750 100644 (file)
@@ -6,44 +6,54 @@
   TypeFamilies
   #-}
 module Data.HList.Graph
-    ( HNodeSet
-    , HNodeIDSet
-    , HNode(..)
-    , HGraph(..)
+    ( Graph(..)
+    , NodeSet
+    , NodeIDSet
+    , Node(..)
+    , LPath(..)
 
-    , HNodeIDA
+    , IsEmpty
+
+    , NodeIDA
     )
     where
 
 import Data.HList.Prelude
 
--- HNodeSet
-class    HNodeSet ns
-instance HNodeSet HNil
-instance HNodeSet ns => HNodeSet (HCons n ns)
+-- NodeSet
+class    NodeSet ns
+instance NodeSet Nil
+instance NodeSet ns => NodeSet (Cons n ns)
+
+-- NodeIDSet
+class    NoDuplicates ids => NodeIDSet ids
+instance NodeIDSet Nil
+instance (OccursNot id ids, NodeIDSet ids) => NodeIDSet (Cons id ids)
 
--- HNodeIDSet
-class    HNoDuplicates nids => HNodeIDSet nids
-instance HNodeIDSet HNil
-instance (HOccursNot nid nids, HNodeIDSet nids) => HNodeIDSet (HCons nid nids)
+-- LPath (list of labeled node IDs)
+class    LPath p
+instance LPath Nil
+instance LPath p => LPath (Cons (Cons l id) p)
 
--- HNode
-class HNodeIDSet (HLinksFrom n) => HNode n
+-- Node
+class NodeIDSet (LinksFrom n) => Node n
     where
-      type HNodeID n
-      type HLinksFrom n
+      type NodeID n
+      type LinksFrom n
 
--- HNodeIDA
-data HNodeIDA
-instance ApplyT HNodeIDA n where
-    type Apply HNodeIDA n = HNodeID n
+-- NodeIDA
+data NodeIDA
+instance ApplyT NodeIDA n where
+    type Apply NodeIDA n = NodeID n
 
--- HGraph
-class ( HNodeSet (HNodes g)
-      , HNoDuplicates (HMap HNodeIDA g)
+-- Graph
+class ( NodeSet (Nodes g)
+      , NoDuplicates (Map NodeIDA g)
       )
-    => HGraph g
+    => Graph g
     where
-      type HNodes g
+      type Empty g
+      type Nodes g
 
---type family HGetNode g n
\ No newline at end of file
+-- IsEmpty
+type family IsEmpty g