Commit 98b5d9f6 authored by simonmar's avatar simonmar

[project @ 2001-08-15 16:27:15 by simonmar]

Slight prettification of class declarations when printed out in
non-interface mode.
parent 01d6d2d0
...@@ -44,6 +44,8 @@ import Outputable ...@@ -44,6 +44,8 @@ import Outputable
import Util ( eqListBy ) import Util ( eqListBy )
import SrcLoc ( SrcLoc ) import SrcLoc ( SrcLoc )
import FastString import FastString
import Maybe ( isNothing, fromJust )
\end{code} \end{code}
...@@ -485,8 +487,11 @@ instance (NamedThing name, Outputable name, Outputable pat) ...@@ -485,8 +487,11 @@ instance (NamedThing name, Outputable name, Outputable pat)
where where
top_matter = ptext SLIT("class") <+> pp_decl_head context clas tyvars <+> pprFundeps fds top_matter = ptext SLIT("class") <+> pp_decl_head context clas tyvars <+> pprFundeps fds
ppr_sig sig = ppr sig <> semi ppr_sig sig = ppr sig <> semi
pp_methods = getPprStyle $ \ sty -> 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 :: Outputable name => HsContext name -> name -> [HsTyVarBndr name] -> SDoc
pp_decl_head context thing tyvars = hsep [pprHsContext context, ppr thing, interppSP tyvars] pp_decl_head context thing tyvars = hsep [pprHsContext context, ppr thing, interppSP tyvars]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment