- ; let { this_mod_name = moduleName this_mod
- ; ext_nm = mkExtNameFn hsc_env eps this_mod_name
- ; local_things = [thing | thing <- typeEnvElts type_env,
- not (isWiredInName (getName thing)) ]
- -- Do not export anything about wired-in things
- -- (GHC knows about them already)
-
- ; abstract_tcs :: NameSet -- TyCons and Classes whose representation is not exposed
- ; abstract_tcs
- | not omit_prags = emptyNameSet -- In the -O case, nothing is abstract
- | otherwise = mkNameSet [ getName thing
- | thing <- local_things
- , isAbstractThing exports thing]
-
- ; decls = [ tyThingToIfaceDecl omit_prags abstract_tcs ext_nm thing
- | thing <- local_things, wantDeclFor exports abstract_tcs thing ]
- -- Don't put implicit Ids and class tycons in the interface file
-
- ; fixities = [(occ,fix) | FixItem occ fix _ <- nameEnvElts fix_env]
- ; deprecs = mkIfaceDeprec src_deprecs
- ; iface_rules
- | omit_prags = []
- | otherwise = sortLt lt_rule $
- map (coreRuleToIfaceRule this_mod_name ext_nm) rules
- ; iface_insts = sortLt lt_inst (map (dfunToIfaceInst this_mod_name) insts)
+ ; let { ext_nm_rhs = mkExtNameFn hsc_env home_mods eps this_mod
+ ; ext_nm_lhs = mkLhsNameFn this_mod
+
+ ; decls = [ tyThingToIfaceDecl ext_nm_rhs thing
+ | thing <- typeEnvElts type_env,
+ not (isImplicitName (getName thing)) ]
+ -- Don't put implicit Ids and class tycons in the interface file
+
+ ; fixities = [(occ,fix) | FixItem occ fix _ <- nameEnvElts fix_env]
+ ; deprecs = mkIfaceDeprec src_deprecs
+ ; iface_rules = map (coreRuleToIfaceRule ext_nm_lhs ext_nm_rhs) rules
+ ; iface_insts = map (instanceToIfaceInst ext_nm_lhs) insts