]> gitweb @ CieloNegro.org - hs-rrdtool.git/blob - Data/HList/Graph.hs
type-level maps and maybes
[hs-rrdtool.git] / Data / HList / Graph.hs
1 {-# LANGUAGE
2   EmptyDataDecls,
3   TypeFamilies
4   #-}
5 module Data.HList.Graph
6     ( Context
7     , Graph
8
9     , Empty
10     , IsEmpty
11 --    , Match
12     )
13     where
14
15 import Data.HList.Prelude
16 import Types.Data.Bool
17
18 -- Graph is a map from node ID to context
19 data Context preNodes node sucNodes
20 data Graph nodeMap
21
22 -- Empty
23 type Empty = Graph Nil
24
25 -- IsEmpty
26 type family   IsEmpty g
27 type instance IsEmpty (Graph Nil)         = True
28 type instance IsEmpty (Graph (Cons x xs)) = False
29
30 -- Match
31 --type Match n g
32 --    = 
33
34 {-
35 -- NodeSet
36 class    NodeSet ns
37 instance NodeSet Nil
38 instance NodeSet ns => NodeSet (Cons n ns)
39
40 -- NodeIDSet
41 class    NoDuplicates ids => NodeIDSet ids
42 instance NodeIDSet Nil
43 instance (OccursNot id ids, NodeIDSet ids) => NodeIDSet (Cons id ids)
44
45 -- LPath (list of labeled node IDs)
46 class    LPath p
47 instance LPath Nil
48 instance LPath p => LPath (Cons (Cons l id) p)
49
50 -- Node
51 class NodeIDSet (LinksFrom n) => Node n
52     where
53       type NodeID n
54       type LinksFrom n
55
56 -- NodeIDA
57 data NodeIDA
58 instance ApplyT NodeIDA n where
59     type Apply NodeIDA n = NodeID n
60
61 -- Graph
62 class ( NodeSet (Nodes g)
63       , NoDuplicates (Map NodeIDA g)
64       )
65     => Graph g
66     where
67       type Empty g
68       type Nodes g
69
70 -- IsEmpty
71 type family IsEmpty g
72 -}