[project @ 2005-03-30 16:24:04 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / HscTypes.lhs
index 9fecb09..c170f52 100644 (file)
@@ -11,7 +11,7 @@ module HscTypes (
        Target(..), TargetId(..), pprTarget, pprTargetId,
        ModuleGraph, emptyMG,
 
-       ModDetails(..), 
+       ModDetails(..), emptyModDetails,
        ModGuts(..), ModImports(..), ForeignStubs(..),
 
        ModSummary(..), showModMsg, isBootSummary,
@@ -188,7 +188,7 @@ hscEPS hsc_env = readIORef (hsc_EPS hsc_env)
 -- module.  If so, use this instead of the file contents (this
 -- is for use in an IDE where the file hasn't been saved by
 -- the user yet).
-data Target = Target TargetId (Maybe StringBuffer)
+data Target = Target TargetId (Maybe (StringBuffer,ClockTime))
 
 data TargetId
   = TargetModule Module           -- | A module name: search for the file
@@ -214,9 +214,15 @@ emptyHomePackageTable  = emptyModuleEnv
 emptyPackageIfaceTable = emptyModuleEnv
 
 data HomeModInfo 
-  = HomeModInfo { hm_iface    :: ModIface,
-                 hm_details  :: ModDetails,
-                 hm_linkable :: Linkable }
+  = HomeModInfo { hm_iface    :: !ModIface,
+                 hm_details  :: !ModDetails,
+                 hm_linkable :: !(Maybe Linkable) }
+               -- hm_linkable might be Nothing if:
+               --   a) this is an .hs-boot module
+               --   b) temporarily during compilation if we pruned away
+               --      the old linkable because it was out of date.
+               -- after a complete compilation (GHC.load), all hm_linkable
+               -- fields in the HPT will be Just.
 \end{code}
 
 Simple lookups in the symbol table.
@@ -358,6 +364,10 @@ data ModDetails
         md_rules    :: ![IdCoreRule]   -- Domain may include Ids from other modules
      }
 
+emptyModDetails = ModDetails { md_types = emptyTypeEnv,
+                              md_insts = [],
+                              md_rules = [] }
+
 -- A ModGuts is carried through the compiler, accumulating stuff as it goes
 -- There is only one ModGuts at any time, the one for the module
 -- being compiled right now.  Once it is compiled, a ModIface and 
@@ -940,7 +950,8 @@ data ModSummary
         ms_mod       :: Module,                        -- Name of the module
        ms_hsc_src   :: HscSource,              -- Source is Haskell, hs-boot, external core
         ms_location  :: ModLocation,           -- Location
-        ms_hs_date   :: ClockTime,             -- Timestamp of summarised file
+        ms_hs_date   :: ClockTime,             -- Timestamp of source file
+       ms_obj_date  :: Maybe ClockTime,        -- Timestamp of object, maybe
         ms_srcimps   :: [Module],              -- Source imports
         ms_imps      :: [Module],              -- Non-source imports
         ms_hspp_file :: Maybe FilePath,                -- Filename of preprocessed source,