[project @ 2001-10-18 08:53:03 by simonmar]
authorsimonmar <unknown>
Thu, 18 Oct 2001 08:53:03 +0000 (08:53 +0000)
committersimonmar <unknown>
Thu, 18 Oct 2001 08:53:03 +0000 (08:53 +0000)
Eeeek!  When looking for an interface for a way other than the normal
way (eg. profiling) we were correctly finding the .p_hi file, but then
reading the .hi file!

Sigbjorn: go stand in the corner for the rest of the day.

MERGE TO STABLE

ghc/compiler/main/Finder.lhs

index f934f8b..83cf28c 100644 (file)
@@ -148,6 +148,15 @@ findPackageMod mod_name hiOnly = do
   let imp_dirs = concatMap (\ pkg -> map ((,) pkg) (import_dirs pkg)) pkgs
       mod_str  = moduleNameUserString mod_name 
       basename = map (\c -> if c == '.' then '/' else c) mod_str
+
+      mkPackageModule mod_name pkg mbFName path =
+        return ( mkModule mod_name (mkFastString (name pkg))
+               , ModuleLocation{ ml_hspp_file = Nothing
+                              , ml_hs_file   = mbFName
+                              , ml_hi_file   = path ++ '.':package_hisuf
+                              , ml_obj_file  = Nothing
+                              })
+
   searchPathExts
        imp_dirs basename
         ((package_hisuf,\ pkg fName path -> mkPackageModule mod_name pkg Nothing path) :
@@ -157,13 +166,6 @@ findPackageMod mod_name hiOnly = do
          , ("lhs", \ pkg fName path -> mkPackageModule mod_name pkg (Just fName) path)
          ]))
  where
-  mkPackageModule mod_name pkg mbFName path =
-    return ( mkModule mod_name (mkFastString (name pkg))
-           , ModuleLocation{ ml_hspp_file = Nothing
-                          , ml_hs_file   = mbFName
-                          , ml_hi_file   = path ++".hi"
-                          , ml_obj_file  = Nothing
-                          })
 
 findPackageModule :: ModuleName -> IO (Maybe (Module, ModuleLocation))
 findPackageModule mod_name = findPackageMod mod_name True