findPackageMod: for source imports, restrict ourselves to looking for hi-boots only
= do { j <- maybeHomeModule name is_source
; case j of
Just home_module -> return (Just home_module)
= do { j <- maybeHomeModule name is_source
; case j of
Just home_module -> return (Just home_module)
- Nothing -> findPackageMod name False
+ Nothing -> findPackageMod name False is_source
}
maybeHomeModule :: ModuleName -> Bool -> IO (Maybe (Module, ModuleLocation))
}
maybeHomeModule :: ModuleName -> Bool -> IO (Maybe (Module, ModuleLocation))
-- for SOURCE imports, check the hi-boot extensions
-- before the source/iface ones, to avoid
-- creating circ Makefile deps.
-- for SOURCE imports, check the hi-boot extensions
-- before the source/iface ones, to avoid
-- creating circ Makefile deps.
mkHiOnlyModuleLocn mod_name hi_file =
return
mkHiOnlyModuleLocn mod_name hi_file =
return
findPackageMod :: ModuleName
-> Bool
findPackageMod :: ModuleName
-> Bool
-> IO (Maybe (Module, ModuleLocation))
-> IO (Maybe (Module, ModuleLocation))
-findPackageMod mod_name hiOnly = do
+findPackageMod mod_name hiOnly is_source = do
pkgs <- getPackageInfo
-- hi-suffix for packages depends on the build tag.
pkgs <- getPackageInfo
-- hi-suffix for packages depends on the build tag.
, ml_obj_file = Nothing
})
, ml_obj_file = Nothing
})
+ -- last chance: .hi-boot-<ver> and .hi-boot
+ hi_boot_ver = "hi-boot-" ++ cHscIfaceFileVersion
+
+ boot_exts =
+ [ (hi_boot_ver, \ fName path -> mkHiOnlyModuleLocn mod_name fName)
+ , ("hi-boot", \ fName path -> mkHiOnlyModuleLocn mod_name fName)
+ ]
+
searchPathExts
imp_dirs basename
searchPathExts
imp_dirs basename
- ((package_hisuf,\ fName path -> retPackageModule mod_name Nothing path) :
- -- can packages contain hi-boots?
- (if hiOnly then [] else
- [ ("hs", \ fName path -> retPackageModule mod_name (Just fName) path)
- , ("lhs", \ fName path -> retPackageModule mod_name (Just fName) path)
- ]))
+ (if is_source then boot_exts else
+ ((package_hisuf,\ fName path -> retPackageModule mod_name Nothing path) :
+ (if hiOnly then [] else
+ [ ("hs", \ fName path -> retPackageModule mod_name (Just fName) path)
+ , ("lhs", \ fName path -> retPackageModule mod_name (Just fName) path)
+ ])))
where
findPackageModule :: ModuleName -> IO (Maybe (Module, ModuleLocation))
where
findPackageModule :: ModuleName -> IO (Maybe (Module, ModuleLocation))
-findPackageModule mod_name = findPackageMod mod_name True
+findPackageModule mod_name = findPackageMod mod_name True False
searchPathExts :: [FilePath]
-> String
searchPathExts :: [FilePath]
-> String