, moduleString -- :: Module -> EncodedString
, moduleUserString -- :: Module -> UserString
+ , mkModule
, mkBasePkgModule -- :: UserString -> Module
- , mkThPkgModule -- :: UserString -> Module
, mkHomeModule -- :: ModuleName -> Module
, isHomeModule -- :: Module -> Bool
, mkPackageModule -- :: ModuleName -> Module
#include "HsVersions.h"
import OccName
import Outputable
-import Packages ( PackageName, basePackage, thPackage )
+import Packages ( PackageName, basePackage )
import CmdLineOpts ( opt_InPackage )
-import FastString ( FastString )
import Unique ( Uniquable(..) )
import Maybes ( expectJust )
import UniqFM
data ModLocation
= ModLocation {
ml_hs_file :: Maybe FilePath,
- ml_hspp_file :: Maybe FilePath, -- path of preprocessed source
- ml_hi_file :: FilePath,
- ml_obj_file :: Maybe FilePath
+
+ ml_hspp_file :: Maybe FilePath, -- Path of preprocessed source
+
+ ml_hi_file :: FilePath, -- Where the .hi file is, whether or not it exists
+ -- Always of form foo.hi, even if there is an hi-boot
+ -- file (we add the -boot suffix later)
+
+ ml_obj_file :: FilePath -- Where the .o file is, whether or not it exists
+ -- (might not exist either because the module
+ -- hasn't been compiled yet, or because
+ -- it is part of a package with a .a file)
}
deriving Show
mod_str ++ replicate (max 0 (16 - length mod_str)) ' '
++" ( " ++ expectJust "showModMsg" (ml_hs_file location) ++ ", "
++ (if use_object
- then expectJust "showModMsg" (ml_obj_file location)
+ then ml_obj_file location
else "interpreted")
++ " )"
where mod_str = moduleUserString mod
\begin{code}
-mkBasePkgModule :: ModuleName -> Module
-mkBasePkgModule mod_nm
- = Module mod_nm pack_info
+mkModule :: PackageName -> ModuleName -> Module
+mkModule pkg_name mod_name
+ = Module mod_name pkg_info
where
- pack_info
- | opt_InPackage == basePackage = ThisPackage
- | otherwise = AnotherPackage
+ pkg_info
+ | opt_InPackage == pkg_name = ThisPackage
+ | otherwise = AnotherPackage
-mkThPkgModule :: ModuleName -> Module
-mkThPkgModule mod_nm
- = Module mod_nm pack_info
- where
- pack_info
- | opt_InPackage == thPackage = ThisPackage
- | otherwise = AnotherPackage
+mkBasePkgModule :: ModuleName -> Module
+mkBasePkgModule mod_nm = mkModule basePackage mod_nm
mkHomeModule :: ModuleName -> Module
mkHomeModule mod_nm = Module mod_nm ThisPackage