+ mg_types :: !TypeEnv,
+ mg_insts :: ![DFunId], -- Instances
+ mg_rules :: ![IdCoreRule], -- Rules from this module
+ mg_binds :: ![CoreBind], -- Bindings for this module
+ mg_foreign :: !ForeignStubs
+ }
+
+-- The ModGuts takes on several slightly different forms:
+--
+-- After simplification, the following fields change slightly:
+-- mg_rules Orphan rules only (local ones now attached to binds)
+-- mg_binds With rules attached
+--
+-- After CoreTidy, the following fields change slightly:
+-- mg_types Now contains Ids as well, replete with final IdInfo
+-- The Ids are only the ones that are visible from
+-- importing modules. Without -O that means only
+-- exported Ids, but with -O importing modules may
+-- see ids mentioned in unfoldings of exported Ids
+--
+-- mg_insts Same DFunIds as before, but with final IdInfo,
+-- and the unique might have changed; remember that
+-- CoreTidy links up the uniques of old and new versions
+--
+-- mg_rules All rules for exported things, substituted with final Ids
+--
+-- mg_binds Tidied
+
+
+
+data ModImports
+ = ModImports {
+ imp_direct :: ![(Module,Bool)], -- Explicitly-imported modules
+ -- Boolean is true if we imported the whole
+ -- module (apart, perhaps, from hiding some)
+ imp_pkg_mods :: !ModuleSet, -- Non-home-package modules on which we depend,
+ -- directly or indirectly
+ imp_home_names :: !NameSet -- Home package things on which we depend,
+ -- directly or indirectly
+ }
+
+data ForeignStubs = NoStubs
+ | ForeignStubs
+ SDoc -- Header file prototypes for
+ -- "foreign exported" functions
+ SDoc -- C stubs to use when calling
+ -- "foreign exported" functions
+ [FastString] -- Headers that need to be included
+ -- into C code generated for this module
+ [Id] -- Foreign-exported binders
+ -- we have to generate code to register these
+
+
+data IfaceDecls = IfaceDecls { dcl_tycl :: [RenamedTyClDecl], -- Sorted
+ dcl_rules :: [RenamedRuleDecl], -- Sorted
+ dcl_insts :: [RenamedInstDecl] } -- Unsorted
+
+mkIfaceDecls :: [RenamedTyClDecl] -> [RenamedRuleDecl] -> [RenamedInstDecl] -> IfaceDecls
+mkIfaceDecls tycls rules insts
+ = IfaceDecls { dcl_tycl = sortLt lt_tycl tycls,
+ dcl_rules = sortLt lt_rule rules,
+ dcl_insts = insts }
+ where
+ d1 `lt_tycl` d2 = tyClDeclName d1 < tyClDeclName d2
+ r1 `lt_rule` r2 = ifaceRuleDeclName r1 < ifaceRuleDeclName r2