From 98b5d9f61854afb1ed4c8cf819154c1b89eb88bf Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 15 Aug 2001 16:27:15 +0000 Subject: [PATCH] [project @ 2001-08-15 16:27:15 by simonmar] Slight prettification of class declarations when printed out in non-interface mode. --- ghc/compiler/hsSyn/HsDecls.lhs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ghc/compiler/hsSyn/HsDecls.lhs b/ghc/compiler/hsSyn/HsDecls.lhs index 6d1befb..5be8245 100644 --- a/ghc/compiler/hsSyn/HsDecls.lhs +++ b/ghc/compiler/hsSyn/HsDecls.lhs @@ -44,6 +44,8 @@ import Outputable import Util ( eqListBy ) import SrcLoc ( SrcLoc ) import FastString + +import Maybe ( isNothing, fromJust ) \end{code} @@ -485,8 +487,11 @@ instance (NamedThing name, Outputable name, Outputable pat) where top_matter = ptext SLIT("class") <+> pp_decl_head context clas tyvars <+> pprFundeps fds ppr_sig sig = ppr sig <> semi + pp_methods = getPprStyle $ \ sty -> - if ifaceStyle sty then empty else ppr methods + if ifaceStyle sty || isNothing methods + then empty + else ppr (fromJust methods) pp_decl_head :: Outputable name => HsContext name -> name -> [HsTyVarBndr name] -> SDoc pp_decl_head context thing tyvars = hsep [pprHsContext context, ppr thing, interppSP tyvars] -- 1.7.10.4