X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FbasicTypes%2FFieldLabel.lhs;h=ccaf094620116c2d4f42624f5174acb383c9e232;hb=fda89b29c748c6cd2fe1fdb477d5c0e8f7d32b90;hp=d8f61d33933b6e6eb95147f37f73e9627200d214;hpb=f9120c200bcf613b58d742802172fb4c08171f0d;p=ghc-hetmet.git diff --git a/ghc/compiler/basicTypes/FieldLabel.lhs b/ghc/compiler/basicTypes/FieldLabel.lhs index d8f61d3..ccaf094 100644 --- a/ghc/compiler/basicTypes/FieldLabel.lhs +++ b/ghc/compiler/basicTypes/FieldLabel.lhs @@ -8,17 +8,27 @@ module FieldLabel where -import Ubiq{-uitous-} +IMP_Ubiq(){-uitous-} -import Name ( Name{-instance Eq/Outputable-} ) -import Type ( Type(..) ) +import Name ( Name{-instance Eq/Outputable-}, NamedThing(..), nameUnique ) +import Type ( SYN_IE(Type) ) + +import Outputable +import Unique ( Uniquable(..) ) \end{code} \begin{code} data FieldLabel - = FieldLabel Name - Type - FieldLabelTag + = FieldLabel Name -- Also used as the Name of the field selector Id + Type -- Type of the field; may have free type variables that + -- are the tyvar of the constructor + -- e.g. data T a = MkT { op1 :: a -> a, op2 :: a -> Int } + -- The type in the FieldLabel for op1 will be simply (a->a). + + FieldLabelTag -- Indicates position within constructor + -- If the same field occurs in more than one constructor + -- then it'll have a separate FieldLabel on each occasion, + -- but with a single name (and presumably the same type!) type FieldLabelTag = Int @@ -42,4 +52,7 @@ instance Outputable FieldLabel where instance NamedThing FieldLabel where getName (FieldLabel n _ _) = n + +instance Uniquable FieldLabel where + uniqueOf (FieldLabel n _ _) = nameUnique n \end{code}