[project @ 2000-10-30 13:46:24 by sewardj]
[ghc-hetmet.git] / ghc / compiler / main / HscTypes.lhs
index 1b119c4..1d6e371 100644 (file)
@@ -9,7 +9,7 @@ module HscTypes (
 
        ModDetails(..), ModIface(..), GlobalSymbolTable, 
        HomeSymbolTable, PackageSymbolTable,
-       HomeIfaceTable, PackageIfaceTable, 
+       HomeIfaceTable, PackageIfaceTable, emptyIfaceTable,
        lookupTable, lookupTableByModName,
 
        IfaceDecls(..), 
@@ -65,13 +65,13 @@ import HsSyn                ( DeprecTxt )
 import RdrHsSyn                ( RdrNameHsDecl, RdrNameTyClDecl )
 import RnHsSyn         ( RenamedTyClDecl, RenamedRuleDecl, RenamedInstDecl )
 
-import CoreSyn         ( CoreRule, IdCoreRule )
+import CoreSyn         ( IdCoreRule )
 import Type            ( Type )
 
 import FiniteMap       ( FiniteMap, emptyFM, addToFM, lookupFM, foldFM )
 import Bag             ( Bag )
 import Maybes          ( seqMaybe )
-import UniqFM          ( UniqFM )
+import UniqFM          ( UniqFM, emptyUFM )
 import Outputable
 import SrcLoc          ( SrcLoc, isGoodSrcLoc )
 import Util            ( thenCmp )
@@ -87,10 +87,14 @@ import UniqSupply   ( UniqSupply )
 \begin{code}
 data ModuleLocation
    = ModuleLocation {
-       hs_file  :: FilePath,
-       hi_file  :: FilePath,
-       obj_file :: FilePath
-      }
+       hs_preprocd_file :: FilePath,   -- location after preprocessing
+       hi_file          :: FilePath,
+       obj_file         :: FilePath
+     }
+     deriving Show
+
+instance Outputable ModuleLocation where
+   ppr = text . show
 \end{code}
 
 For a module in another package, the hs_file and obj_file
@@ -181,6 +185,9 @@ type PackageIfaceTable  = IfaceTable
 type HomeSymbolTable    = SymbolTable  -- Domain = modules in the home package
 type PackageSymbolTable = SymbolTable  -- Domain = modules in the some other package
 type GlobalSymbolTable  = SymbolTable  -- Domain = all modules
+
+emptyIfaceTable :: IfaceTable
+emptyIfaceTable = emptyUFM
 \end{code}
 
 Simple lookups in the symbol table.
@@ -301,14 +308,12 @@ data Deprecations = NoDeprecs
                                                                -- 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 -> case lookupNameEnv env name of
-                           Just (_, txt) -> Just txt
-                           Nothing       -> Nothing
+lookupDeprec :: Deprecations -> Name -> Maybe DeprecTxt
+lookupDeprec NoDeprecs        name = Nothing
+lookupDeprec (DeprecAll  txt) name = Just txt
+lookupDeprec (DeprecSome env) name = case lookupNameEnv env name of
+                                           Just (_, txt) -> Just txt
+                                           Nothing       -> Nothing
 
 type InstEnv    = UniqFM ClsInstEnv            -- Maps Class to instances for that class