From: simonmar Date: Tue, 21 Aug 2001 10:03:04 +0000 (+0000) Subject: [project @ 2001-08-21 10:03:04 by simonmar] X-Git-Tag: Approximately_9120_patches~1157 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=eaa2e86dc04263172feda7e984c24c9cd9ea94ef;p=ghc-hetmet.git [project @ 2001-08-21 10:03:04 by simonmar] Another case of parenthesising operator names, this time in a ConDecl. --- diff --git a/ghc/compiler/hsSyn/HsDecls.lhs b/ghc/compiler/hsSyn/HsDecls.lhs index 6f06cd8..04b2af1 100644 --- a/ghc/compiler/hsSyn/HsDecls.lhs +++ b/ghc/compiler/hsSyn/HsDecls.lhs @@ -611,8 +611,14 @@ instance (Outputable name) => Outputable (ConDecl name) where ppr_con_details con (InfixCon ty1 ty2) = hsep [ppr_bang ty1, ppr con, ppr_bang ty2] +-- ConDecls generated by MkIface.ifaceTyCls always have a VanillaCon, even +-- if the constructor is an infix one. This is because in an interface file +-- we don't distinguish between the two. Hence when printing these for the +-- user, we need to parenthesise infix constructor names. ppr_con_details con (VanillaCon tys) - = ppr con <+> hsep (map (ppr_bang) tys) + = getPprStyle $ \ sty -> + hsep ((if ifaceStyle sty then ppr con else ppr_var con) + : map (ppr_bang) tys) ppr_con_details con (RecCon fields) = ppr con <+> braces (sep (punctuate comma (map ppr_field fields)))