[project @ 2000-10-27 15:40:01 by simonpj]
[ghc-hetmet.git] / ghc / compiler / rename / RnHiFiles.lhs
index 4e067b9..9a13669 100644 (file)
@@ -49,6 +49,7 @@ import Maybes         ( maybeToBool, orElse )
 import StringBuffer     ( hGetStringBuffer )
 import FastString      ( mkFastString )
 import ErrUtils         ( Message )
+import Finder          ( findModule )
 import Lex
 import FiniteMap
 import Outputable
@@ -240,16 +241,16 @@ addModDeps mod new_deps mod_deps
 --     Loading the export list
 -----------------------------------------------------
 
-loadExports :: (Version, [ExportItem]) -> RnM d (Version, Avails)
+loadExports :: (Version, [ExportItem]) -> RnM d (Version, [(ModuleName,Avails)])
 loadExports (vers, items)
   = getModuleRn                                `thenRn` \ this_mod ->
     mapRn (loadExport this_mod) items          `thenRn` \ avails_s ->
-    returnRn (vers, concat avails_s)
+    returnRn (vers, avails_s)
 
 
-loadExport :: Module -> ExportItem -> RnM d [AvailInfo]
+loadExport :: Module -> ExportItem -> RnM d (ModuleName, Avails)
 loadExport this_mod (mod, entities)
-  | mod == moduleName this_mod = returnRn []
+  | mod == moduleName this_mod = returnRn (mod, [])
        -- If the module exports anything defined in this module, just ignore it.
        -- Reason: otherwise it looks as if there are two local definition sites
        -- for the thing, and an error gets reported.  Easiest thing is just to
@@ -267,7 +268,8 @@ loadExport this_mod (mod, entities)
        -- but it's a bogus thing to do!
 
   | otherwise
-  = mapRn (load_entity mod) entities
+  = mapRn (load_entity mod) entities   `thenRn` \ avails ->
+    returnRn (mod, avails)
   where
     new_name mod occ = newGlobalName mod occ
 
@@ -406,7 +408,7 @@ loadDeprecs m (Just (Right prs)) = setModuleRn m                            $
 loadDeprec deprec_env (n, txt)
   = lookupOrigName n           `thenRn` \ name ->
     traceRn (text "Loaded deprecation(s) for" <+> ppr name <> colon <+> ppr txt) `thenRn_`
-    returnRn (extendNameEnv deprec_env name txt)
+    returnRn (extendNameEnv deprec_env name (name,txt))
 \end{code}
 
 
@@ -486,13 +488,11 @@ findAndReadIface :: SDoc -> ModuleName
 
 findAndReadIface doc_str mod_name hi_boot_file
   = traceRn trace_msg                  `thenRn_`
-
-    getFinderRn                                `thenRn` \ finder ->
-    ioToRnM (finder mod_name)          `thenRn` \ maybe_found ->
+    ioToRnM (findModule mod_name)      `thenRn` \ maybe_found ->
 
     case maybe_found of
       Right (Just (mod,locn))
-       | hi_boot_file -> readIface mod (hi_file locn ++ "-hi-boot")
+       | hi_boot_file -> readIface mod (hi_file locn ++ "-boot")
        | otherwise    -> readIface mod (hi_file locn)
        
        -- Can't find it