+-----------------------------------------------------
+-- Unfolding and UnfoldingGuidance
+-----------------------------------------------------
+
+\begin{code}
+instance Outputable UnfoldingGuidance where
+ ppr UnfoldNever = ptext (sLit "NEVER")
+ ppr (UnfoldIfGoodArgs { ug_arity = v, ug_args = cs
+ , ug_size = size, ug_res = discount })
+ = hsep [ ptext (sLit "IF_ARGS"), int v,
+ brackets (hsep (map int cs)),
+ int size,
+ int discount ]
+
+instance Outputable Unfolding where
+ ppr NoUnfolding = ptext (sLit "No unfolding")
+ ppr (OtherCon cs) = ptext (sLit "OtherCon") <+> ppr cs
+ ppr (CompulsoryUnfolding e) = ptext (sLit "Compulsory") <+> ppr e
+ ppr (InlineRule { uf_tmpl = e, uf_is_value = hnf, uf_arity = arity, uf_worker = wkr })
+ = ptext (sLit "INLINE") <+> sep [ppr arity <+> ppr hnf <+> ppr wkr, ppr e]
+ ppr (CoreUnfolding e top hnf cheap g)
+ = ptext (sLit "Unf") <+> sep [ppr top <+> ppr hnf <+> ppr cheap <+> ppr g,
+ ppr e]
+
+pprInlineInfo :: Unfolding -> SDoc -- Print an inline RULE
+pprInlineInfo unf | isInlineRule unf = ppr unf
+ | otherwise = empty
+\end{code}
+
+-----------------------------------------------------
+-- Rules
+-----------------------------------------------------