[project @ 2000-10-26 07:19:52 by simonpj]
[ghc-hetmet.git] / ghc / compiler / main / HscTypes.lhs
index 99b07b8..9550ac6 100644 (file)
@@ -16,7 +16,7 @@ module HscTypes (
 
        VersionInfo(..), initialVersionInfo,
 
-       TyThing(..), groupTyThings,
+       TyThing(..), groupTyThings, isTyClThing,
 
        TypeEnv, extendTypeEnv, lookupTypeEnv, 
 
@@ -54,7 +54,6 @@ import Module         ( Module, ModuleName, ModuleEnv,
                        )
 import Rules           ( RuleBase )
 import VarSet          ( TyVarSet )
-import VarEnv          ( emptyVarEnv )
 import Id              ( Id )
 import Class           ( Class )
 import TyCon           ( TyCon )
@@ -65,7 +64,7 @@ import HsSyn          ( DeprecTxt )
 import RdrHsSyn                ( RdrNameHsDecl, RdrNameTyClDecl )
 import RnHsSyn         ( RenamedTyClDecl, RenamedRuleDecl, RenamedInstDecl )
 
-import CoreSyn         ( CoreRule )
+import CoreSyn         ( CoreRule, IdCoreRule )
 import Type            ( Type )
 
 import FiniteMap       ( FiniteMap, emptyFM, addToFM, lookupFM, foldFM )
@@ -127,7 +126,7 @@ data ModIface
                                                -- (changing usages doesn't affect the version of
                                                --  this module)
 
-        mi_exports  :: Avails,                 -- What it exports
+        mi_exports  :: [(ModuleName,Avails)],  -- What it exports
                                                -- Kept sorted by (mod,occ),
                                                -- to make version comparisons easier
 
@@ -150,7 +149,7 @@ data ModDetails
        -- The next three fields are created by the typechecker
         md_types    :: TypeEnv,
         md_insts    :: [DFunId],       -- Dfun-ids for the instances in this module
-        md_rules    :: [(Id,CoreRule)] -- Domain may include Ids from other modules
+        md_rules    :: [IdCoreRule]    -- Domain may include Ids from other modules
      }
 \end{code}
 
@@ -216,6 +215,11 @@ data TyThing = AnId   Id
             | ATyCon TyCon
             | AClass Class
 
+isTyClThing :: TyThing -> Bool
+isTyClThing (ATyCon _) = True
+isTyClThing (AClass _) = True
+isTyClThing (AnId   _) = False
+
 instance NamedThing TyThing where
   getName (AnId id)   = getName id
   getName (ATyCon tc) = getName tc
@@ -289,16 +293,19 @@ initialVersionInfo = VersionInfo { vers_module  = initialVersion,
                                   vers_decls   = emptyNameEnv }
 
 data Deprecations = NoDeprecs
-                 | DeprecAll DeprecTxt                 -- Whole module deprecated
-                 | DeprecSome (NameEnv DeprecTxt)      -- Some things deprecated
-                                                       -- Just "big" names
+                 | DeprecAll DeprecTxt                         -- Whole module deprecated
+                 | DeprecSome (NameEnv (Name,DeprecTxt))       -- Some things deprecated
+                                                               -- Just "big" names
+               -- We keep the Name in the range, so we can print them out
 
 lookupDeprec :: ModIface -> Name -> Maybe DeprecTxt
 lookupDeprec iface name
   = case mi_deprecs iface of
        NoDeprecs      -> Nothing
        DeprecAll txt  -> Just txt
-       DeprecSome env -> lookupNameEnv env name
+       DeprecSome env -> case lookupNameEnv env name of
+                           Just (_, txt) -> Just txt
+                           Nothing       -> Nothing
 
 type InstEnv    = UniqFM ClsInstEnv            -- Maps Class to instances for that class