-print_it sty suff prec var
- = ppBesides [ppStr "infix", ppStr suff, ppSP, ppInt prec, ppSP, pprSym sty var]
+\begin{code}
+instance (NamedThing name, Outputable name, Outputable pat)
+ => Outputable (HsDecl flexi name pat) where
+
+ ppr (TyD td) = ppr td
+ ppr (ClD cd) = ppr cd
+ ppr (SigD sig) = ppr sig
+ ppr (ValD binds) = ppr binds
+ ppr (DefD def) = ppr def
+ ppr (InstD inst) = ppr inst
+
+#ifdef DEBUG
+-- hsDeclName needs more context when DEBUG is on
+instance (NamedThing name, Outputable name, Outputable pat, Eq name)
+ => Eq (HsDecl flex name pat) where
+ d1 == d2 = hsDeclName d1 == hsDeclName d2
+
+instance (NamedThing name, Outputable name, Outputable pat, Ord name)
+ => Ord (HsDecl flex name pat) where
+ d1 `compare` d2 = hsDeclName d1 `compare` hsDeclName d2
+#else
+instance (Eq name) => Eq (HsDecl flex name pat) where
+ d1 == d2 = hsDeclName d1 == hsDeclName d2
+
+instance (Ord name) => Ord (HsDecl flexi name pat) where
+ d1 `compare` d2 = hsDeclName d1 `compare` hsDeclName d2
+#endif