+\begin{code}
+pprIdDetails :: Id -> SDoc
+pprIdDetails id | isGlobalId id = ppr (globalIdDetails id)
+ | isExportedId id = ptext SLIT("[Exported]")
+ | isSpecPragmaId id = ptext SLIT("[SpecPrag]")
+ | otherwise = empty
+
+ppIdInfo :: Id -> IdInfo -> SDoc
+ppIdInfo b info
+ = hsep [ ppArityInfo a,
+ ppWorkerInfo (workerInfo info),
+#ifdef OLD_STRICTNESS
+ ppStrictnessInfo s,
+ ppCprInfo m,
+#endif
+ pprNewStrictness (newStrictnessInfo info),
+ vcat (map (pprCoreRule (ppr b)) (rulesRules p))
+ -- Inline pragma, occ, demand, lbvar info
+ -- printed out with all binders (when debug is on);
+ -- see PprCore.pprIdBndr
+ ]
+ where
+ a = arityInfo info
+#ifdef OLD_STRICTNESS
+ s = strictnessInfo info
+ m = cprInfo info
+#endif
+ p = specInfo info
+\end{code}
+
+
+\begin{code}
+pprIdRules :: [IdCoreRule] -> SDoc
+pprIdRules rules = vcat (map pprIdRule rules)
+
+pprIdRule :: IdCoreRule -> SDoc
+pprIdRule (id,rule) = pprCoreRule (ppr id) rule
+
+pprCoreRule :: SDoc -> CoreRule -> SDoc
+pprCoreRule pp_fn (BuiltinRule name _)
+ = ifPprDebug (ptext SLIT("Built in rule for") <+> pp_fn <> colon
+ <+> doubleQuotes (ftext name))
+
+pprCoreRule pp_fn (Rule name act tpl_vars tpl_args rhs)
+ = doubleQuotes (ftext name) <+> ppr act <+>
+ sep [
+ ptext SLIT("__forall") <+> braces (sep (map pprTypedBinder tpl_vars)),
+ nest 2 (pp_fn <+> sep (map pprArg tpl_args)),
+ nest 2 (ptext SLIT("=") <+> pprCoreExpr rhs)
+ ] <+> semi