+ = hPutCol if_hdl upp_fixity fixities
+
+ifaceRules :: Handle -> [ProtoCoreRule] -> IdSet -> IO ()
+ifaceRules if_hdl rules emitted
+ | opt_OmitInterfacePragmas -- Don't emit rules if we are suppressing
+ -- interface pragmas
+ || (null orphan_rule_pretties && null local_id_pretties)
+ = return ()
+ | otherwise
+ = printForIface if_hdl (vcat [
+ ptext SLIT("{-## __R"),
+ vcat orphan_rule_pretties,
+ vcat local_id_pretties,
+ ptext SLIT("##-}")
+ ])
+ where
+ orphan_rule_pretties = [ pprCoreRule (Just fn) rule
+ | ProtoCoreRule _ fn rule <- rules
+ ]
+ local_id_pretties = [ pprCoreRule (Just fn) rule
+ | fn <- varSetElems emitted,
+ rule <- rulesRules (idSpecialisation fn),
+ all (`elemVarSet` emitted) (varSetElems (ruleSomeLhsFreeVars interestingId rule))
+ -- Spit out a rule only if all its lhs free vars are emitted
+ -- This is a good reason not to do it when we emit the Id itself
+ ]
+
+ifaceDeprecations :: Handle -> [Deprecation Name] -> IO ()
+ifaceDeprecations if_hdl [] = return ()
+ifaceDeprecations if_hdl deprecations
+ = printForIface if_hdl (vcat [
+ ptext SLIT("{-## __D"),
+ vcat [ pprIE ie <+> doubleQuotes (ppr txt) <> semi | Deprecation ie txt <- deprecations ],
+ ptext SLIT("##-}")
+ ])
+ where
+ pprIE (IEVar n ) = ppr n
+ pprIE (IEThingAbs n ) = ppr n
+ pprIE (IEThingAll n ) = hcat [ppr n, text "(..)"]
+ pprIE (IEThingWith n ns) = ppr n <> parens (hcat (punctuate comma (map ppr ns)))
+ pprIE (IEModuleContents _ ) = empty
+\end{code}