+
+
+%************************************************************************
+%* *
+ The ModSummary Type
+%* *
+%************************************************************************
+
+\begin{code}
+-- The ModLocation contains both the original source filename and the
+-- filename of the cleaned-up source file after all preprocessing has been
+-- done. The point is that the summariser will have to cpp/unlit/whatever
+-- all files anyway, and there's no point in doing this twice -- just
+-- park the result in a temp file, put the name of it in the location,
+-- and let @compile@ read from that file on the way back up.
+
+
+type ModuleGraph = [ModSummary] -- the module graph, topologically sorted
+
+emptyMG :: ModuleGraph
+emptyMG = []
+
+data ModSummary
+ = ModSummary {
+ ms_mod :: Module, -- name, package
+ ms_location :: ModLocation, -- location
+ ms_srcimps :: [ModuleName], -- source imports
+ ms_imps :: [ModuleName], -- non-source imports
+ ms_hs_date :: ClockTime -- timestamp of summarised file
+ }
+
+instance Outputable ModSummary where
+ ppr ms
+ = sep [text "ModSummary {",
+ nest 3 (sep [text "ms_hs_date = " <> text (show (ms_hs_date ms)),
+ text "ms_mod =" <+> ppr (ms_mod ms) <> comma,
+ text "ms_imps =" <+> ppr (ms_imps ms),
+ text "ms_srcimps =" <+> ppr (ms_srcimps ms)]),
+ char '}'
+ ]
+
+ms_allimps ms = ms_srcimps ms ++ ms_imps ms
+
+modSummaryName :: ModSummary -> ModuleName
+modSummaryName = moduleName . ms_mod
+\end{code}