[project @ 2001-08-15 16:27:15 by simonmar]
authorsimonmar <unknown>
Wed, 15 Aug 2001 16:27:15 +0000 (16:27 +0000)
committersimonmar <unknown>
Wed, 15 Aug 2001 16:27:15 +0000 (16:27 +0000)
Slight prettification of class declarations when printed out in
non-interface mode.

ghc/compiler/hsSyn/HsDecls.lhs

index 6d1befb..5be8245 100644 (file)
@@ -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]