[project @ 1996-04-05 08:26:04 by partain]
[ghc-hetmet.git] / ghc / compiler / basicTypes / FieldLabel.lhs
1 %
2 % (c) The AQUA Project, Glasgow University, 1996
3 %
4 \section[FieldLabel]{The @FieldLabel@ type}
5
6 \begin{code}
7 #include "HsVersions.h"
8
9 module FieldLabel where
10
11 import Ubiq{-uitous-}
12
13 import Name             ( Name{-instance Eq/Outputable-} )
14 import Type             ( Type(..) )
15 \end{code}
16
17 \begin{code}
18 data FieldLabel
19   = FieldLabel  Name
20                 Type
21                 FieldLabelTag
22
23 type FieldLabelTag = Int
24
25 mkFieldLabel = FieldLabel
26
27 firstFieldLabelTag :: FieldLabelTag
28 firstFieldLabelTag = 1
29
30 allFieldLabelTags :: [FieldLabelTag]
31 allFieldLabelTags = [1..]
32
33 fieldLabelName (FieldLabel n _  _)   = n
34 fieldLabelType (FieldLabel _ ty _)   = ty
35 fieldLabelTag  (FieldLabel _ _  tag) = tag
36
37 instance Eq FieldLabel where
38     (FieldLabel n1 _ _) == (FieldLabel n2 _ _) = n1 == n2
39
40 instance Outputable FieldLabel where
41     ppr sty (FieldLabel n _ _) = ppr sty n
42
43 instance NamedThing FieldLabel
44     -- ToDo: fill this in
45 \end{code}