+initFinder :: [PackageConfig] -> IO ()
+initFinder pkgs = return ()
+
+-- empty, and lazilly fill in the package cache
+flushPackageCache :: [PackageConfig] -> IO ()
+flushPackageCache pkgs = return ()
+
+emptyHomeDirCache :: IO ()
+emptyHomeDirCache = return ()
+
+findModule :: ModuleName -> IO (Maybe (Module, ModLocation))
+findModule name = findModuleDep name False
+
+findModuleDep :: ModuleName -> Bool -> IO (Maybe (Module, ModLocation))
+findModuleDep name is_source
+ = do { j <- maybeHomeModule name is_source
+ ; case j of
+ Just home_module -> return (Just home_module)
+ Nothing -> findPackageMod name False is_source
+ }
+
+maybeHomeModule :: ModuleName -> Bool -> IO (Maybe (Module, ModLocation))
+maybeHomeModule mod_name is_source = do
+ home_path <- readIORef v_Import_paths
+ hisuf <- readIORef v_Hi_suf
+ mode <- readIORef v_GhcMode
+
+ let mod_str = moduleNameUserString mod_name
+ basename = map (\c -> if c == '.' then '/' else c) mod_str
+
+ -- In compilation manager modes, we look for source files in the home
+ -- package because we can compile these automatically. In one-shot
+ -- compilation mode we look for .hi files only.
+ --
+ -- When generating dependencies, we're interested in either category.
+ --
+ source_exts =
+ [ ("hs", \ fName path -> mkHomeModuleLocn mod_name path fName)
+ , ("lhs", \ fName path -> mkHomeModuleLocn mod_name path fName)
+ ]
+ hi_exts = [ (hisuf, \ fName path -> mkHiOnlyModuleLocn mod_name fName) ]
+
+ std_exts
+ | mode == DoMkDependHS = hi_exts ++ source_exts
+ | isCompManagerMode mode = source_exts
+ | otherwise = hi_exts
+
+ -- 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 home_path basename
+ (if is_source then boot_exts else (std_exts ++ boot_exts))
+ -- 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
+ ( mkHomeModule mod_name
+ , ModLocation{ ml_hspp_file = Nothing
+ , ml_hs_file = Nothing
+ , ml_hi_file = hi_file
+ , ml_obj_file = Nothing
+ }
+ )
+
+-- The .hi file always follows the module name, whereas the object
+-- file may follow the name of the source file in the case where the
+-- two differ (see summariseFile in compMan/CompManager.lhs).
+
+mkHomeModuleLocn mod_name
+ basename -- everything but the extension
+ source_fn -- full path to the source (required)
+ = do