[project @ 2001-08-21 10:03:04 by simonmar]
authorsimonmar <unknown>
Tue, 21 Aug 2001 10:03:04 +0000 (10:03 +0000)
committersimonmar <unknown>
Tue, 21 Aug 2001 10:03:04 +0000 (10:03 +0000)
Another case of parenthesising operator names, this time in a ConDecl.

ghc/compiler/hsSyn/HsDecls.lhs

index 6f06cd8..04b2af1 100644 (file)
@@ -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)))