X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FHscTypes.lhs;h=51126ef7f19aa16e6ccc536eea3d14d5adb01a5d;hb=17879095049f5705c9734cab4f4c5d56f61f81a7;hp=9a6dfd19d65529d24801d58dd5c73777b5a006fc;hpb=dbb27b50948726c09fae681bca921ba3c00d859b;p=ghc-hetmet.git diff --git a/ghc/compiler/main/HscTypes.lhs b/ghc/compiler/main/HscTypes.lhs index 9a6dfd1..51126ef 100644 --- a/ghc/compiler/main/HscTypes.lhs +++ b/ghc/compiler/main/HscTypes.lhs @@ -10,9 +10,10 @@ module HscTypes ( TyThing(..), lookupTypeEnv, lookupFixityEnv, - WhetherHasOrphans, ImportVersion, ExportItem, + WhetherHasOrphans, ImportVersion, ExportItem, WhatsImported(..), PersistentRenamerState(..), IsBootInterface, Avails, DeclsMap, - IfaceInsts, IfaceRules, DeprecationEnv, OrigNameEnv, + IfaceInsts, IfaceRules, DeprecationEnv, + OrigNameEnv(..), OrigNameNameEnv, OrigNameIParamEnv, AvailEnv, AvailInfo, GenAvailInfo(..), PersistentCompilerState(..), @@ -61,6 +62,7 @@ import VarSet ( TyVarSet ) import Panic ( panic ) import Outputable import SrcLoc ( SrcLoc, isGoodSrcLoc ) +import Util ( thenCmp ) \end{code} %************************************************************************ @@ -360,9 +362,14 @@ we just store junk. Then when we find the binding site, we fix it up. \begin{code} data OrigNameEnv - = Orig { origNames :: FiniteMap (ModuleName,OccName) Name, -- Ensures that one original name gets one unique - origIParam :: FiniteMap OccName Name -- Ensures that one implicit parameter name gets one unique + = Orig { origNames :: OrigNameNameEnv, + -- Ensures that one original name gets one unique + origIParam :: OrigNameIParamEnv + -- Ensures that one implicit parameter name gets one unique } + +type OrigNameNameEnv = FiniteMap (ModuleName,OccName) Name +type OrigNameIParamEnv = FiniteMap OccName Name \end{code} @@ -453,6 +460,29 @@ data Provenance ImportReason PrintUnqualified +-- Just used for grouping error messages (in RnEnv.warnUnusedBinds) +instance Eq Provenance where + p1 == p2 = case p1 `compare` p2 of EQ -> True; _ -> False + +instance Eq ImportReason where + p1 == p2 = case p1 `compare` p2 of EQ -> True; _ -> False + +instance Ord Provenance where + compare LocalDef LocalDef = EQ + compare LocalDef (NonLocalDef _ _) = LT + compare (NonLocalDef _ _) LocalDef = GT + + compare (NonLocalDef reason1 _) (NonLocalDef reason2 _) + = compare reason1 reason2 + +instance Ord ImportReason where + compare ImplicitImport ImplicitImport = EQ + compare ImplicitImport (UserImport _ _ _) = LT + compare (UserImport _ _ _) ImplicitImport = GT + compare (UserImport m1 loc1 _) (UserImport m2 loc2 _) + = (m1 `compare` m2) `thenCmp` (loc1 `compare` loc2) + + {- Moved here from Name. pp_prov (LocalDef _ Exported) = char 'x'