From: simonmar Date: Thu, 16 Aug 2001 10:25:21 +0000 (+0000) Subject: [project @ 2001-08-16 10:25:21 by simonmar] X-Git-Tag: Approximately_9120_patches~1215 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a035c70f3f5606672be0534e3cf268e9d81f8a8e;p=ghc-hetmet.git [project @ 2001-08-16 10:25:21 by simonmar] Prettier output for GHCi's :info - put parenthesis around operators in type signatures (both IfaceSig and ClassOpSig) - don't use the cryptic '= ::' notation for indicating that a class op has a default method, instead put the information in a comment after the type. --- diff --git a/ghc/compiler/hsSyn/HsBinds.lhs b/ghc/compiler/hsSyn/HsBinds.lhs index 4050a2e..ac71099 100644 --- a/ghc/compiler/hsSyn/HsBinds.lhs +++ b/ghc/compiler/hsSyn/HsBinds.lhs @@ -15,6 +15,7 @@ import {-# SOURCE #-} HsExpr ( HsExpr, pprExpr, GRHSs, pprPatBind ) -- friends: +import HsImpExp ( ppr_var ) import HsTypes ( HsType ) import CoreSyn ( CoreExpr ) import PprCore ( {- instance Outputable (Expr a) -} ) @@ -335,12 +336,21 @@ ppr_sig (Sig var ty _) = sep [ppr var <+> dcolon, nest 4 (ppr ty)] ppr_sig (ClassOpSig var dm ty _) - = sep [ppr var <+> pp_dm <+> dcolon, nest 4 (ppr ty)] + = getPprStyle $ \ sty -> + if ifaceStyle sty + then sep [ ppr var <+> pp_dm <+> dcolon, nest 4 (ppr ty) ] + else sep [ ppr_var var <+> dcolon, + nest 4 (ppr ty), + nest 4 (pp_dm_comment) ] where pp_dm = case dm of DefMeth _ -> equals -- Default method indicator GenDefMeth -> semi -- Generic method indicator NoDefMeth -> empty -- No Method at all + pp_dm_comment = case dm of + DefMeth _ -> text "{- has default method -}" + GenDefMeth -> text "{- has generic method -}" + NoDefMeth -> empty -- No Method at all ppr_sig (SpecSig var ty _) = sep [ hsep [text "{-# SPECIALIZE", ppr var, dcolon], diff --git a/ghc/compiler/hsSyn/HsDecls.lhs b/ghc/compiler/hsSyn/HsDecls.lhs index 5be8245..6f06cd8 100644 --- a/ghc/compiler/hsSyn/HsDecls.lhs +++ b/ghc/compiler/hsSyn/HsDecls.lhs @@ -26,6 +26,7 @@ module HsDecls ( -- friends: import HsBinds ( HsBinds, MonoBinds, Sig(..), FixitySig(..) ) import HsExpr ( HsExpr ) +import HsImpExp ( ppr_var ) import HsTypes import PprCore ( pprCoreRule ) import HsCore ( UfExpr, UfBinder, HsIdInfo, pprHsIdInfo, @@ -456,7 +457,10 @@ instance (NamedThing name, Outputable name, Outputable pat) => Outputable (TyClDecl name pat) where ppr (IfaceSig {tcdName = var, tcdType = ty, tcdIdInfo = info}) - = hsep [ppr var, dcolon, ppr ty, pprHsIdInfo info] + = getPprStyle $ \ sty -> + hsep [ if ifaceStyle sty then ppr var else ppr_var var, + dcolon, ppr ty, pprHsIdInfo info + ] ppr (ForeignType {tcdName = tycon}) = hsep [ptext SLIT("foreign import type dotnet"), ppr tycon]