\begin{code}
module HscTypes (
- Finder, ModuleLocation(..),
+ ModuleLocation(..),
ModDetails(..), ModIface(..), GlobalSymbolTable,
HomeSymbolTable, PackageSymbolTable,
- HomeIfaceTable, PackageIfaceTable,
+ HomeIfaceTable, PackageIfaceTable, emptyIfaceTable,
lookupTable, lookupTableByModName,
IfaceDecls(..),
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 )
%************************************************************************
%* *
-\subsection{The Finder type}
+\subsection{Module locations}
%* *
%************************************************************************
\begin{code}
-type Finder = ModuleName -> IO (Maybe (Module, ModuleLocation))
-
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
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.
-- 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