summaryrefslogtreecommitdiff
path: root/src/Grasp/Types.hs
blob: 62d80430f89c530f0d6a49f7288b400bf6d217b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module Grasp.Types (
	Instruction(..),
	EdgeLabel(..),
	GNode(..),
	GEdge(..),

	gnode,
	gninst,
	gefrom,
	geto,
	gelabel
    ) where




import Grasp.Graph( Node, LNode, LEdge )




newtype Instruction = Instruction String
    deriving (Eq, Show)

newtype EdgeLabel = EdgeLabel String
    deriving (Eq, Show)

newtype GNode = GNode (LNode Instruction)
    deriving (Eq, Show)

newtype GEdge = GEdge (LEdge EdgeLabel)
    deriving (Eq, Show)




gnode :: GNode -> Node
gnode (GNode a) = fst a

gninst :: GNode -> Instruction
gninst (GNode a) = snd a




gefrom :: GEdge -> Node
gefrom (GEdge (a,_,_)) = a

geto :: GEdge -> Node
geto (GEdge (_,b,_)) = b

gelabel :: GEdge -> EdgeLabel
gelabel (GEdge (_,_,c)) = c