-
- mi_exports :: ![(ModuleName,Avails)],
- -- What it exports Kept sorted by (mod,occ), to make
- -- version comparisons easier
-
- mi_globals :: !GlobalRdrEnv, -- Its top level environment
-
- mi_fixities :: !(NameEnv Fixity), -- Fixities
- mi_deprecs :: !Deprecations, -- Deprecations
-
- mi_decls :: IfaceDecls -- The RnDecls form of ModDetails
+ mi_usages :: [Usage],
+ -- NOT STRICT! we read this field lazily from the interface file
+ -- It is *only* consulted by the recompilation checker
+
+ -- Exports
+ -- Kept sorted by (mod,occ), to make version comparisons easier
+ mi_exports :: ![IfaceExport],
+ mi_exp_vers :: !Version, -- Version number of export list
+
+ -- Fixities
+ mi_fixities :: [(OccName,Fixity)],
+ -- NOT STRICT! we read this field lazily from the interface file
+
+ -- Deprecations
+ mi_deprecs :: IfaceDeprecs,
+ -- NOT STRICT! we read this field lazily from the interface file
+
+ -- Type, class and variable declarations
+ -- The version of an Id changes if its fixity or deprecations change
+ -- (as well as its type of course)
+ -- Ditto data constructors, class operations, except that
+ -- the version of the parent class/tycon changes
+ mi_decls :: [(Version,IfaceDecl)], -- Sorted
+
+ mi_globals :: !(Maybe GlobalRdrEnv),
+ -- Binds all the things defined at the top level in
+ -- the *original source* code for this module. which
+ -- is NOT the same as mi_exports, nor mi_decls (which
+ -- may contains declarations for things not actually
+ -- defined by the user). Used for GHCi and for inspecting
+ -- the contents of modules via the GHC API only.
+ --
+ -- (We need the source file to figure out the
+ -- top-level environment, if we didn't compile this module
+ -- from source then this field contains Nothing).
+ --
+ -- Strictly speaking this field should live in the
+ -- HomeModInfo, but that leads to more plumbing.
+
+ -- Instance declarations and rules
+ mi_insts :: [IfaceInst], -- Sorted
+ mi_rules :: [IfaceRule], -- Sorted
+ mi_rule_vers :: !Version, -- Version number for rules and instances combined
+
+ -- Cached environments for easy lookup
+ -- These are computed (lazily) from other fields
+ -- and are not put into the interface file
+ mi_dep_fn :: Name -> Maybe DeprecTxt, -- Cached lookup for mi_deprecs
+ mi_fix_fn :: OccName -> Fixity, -- Cached lookup for mi_fixities
+ mi_ver_fn :: OccName -> Maybe Version -- Cached lookup for mi_decls
+ -- The Nothing in mi_ver_fn means that the thing
+ -- isn't in decls. It's useful to know that when
+ -- seeing if we are up to date wrt the old interface