- pp_name (FunRhs fun) = ppr fun -- Not pprBndr; the AbsBinds will
- -- have printed the signature
- pp_name LambdaExpr = char '\\'
- pp_name other = empty
+ (herald, other_pats)
+ = case ctxt of
+ FunRhs fun is_infix
+ | not is_infix -> (ppr fun, pats)
+ -- f x y z = e
+ -- Not pprBndr; the AbsBinds will
+ -- have printed the signature
+
+ | null pats3 -> (pp_infix, [])
+ -- x &&& y = e
+
+ | otherwise -> (parens pp_infix, pats3)
+ -- (x &&& y) z = e
+ where
+ (pat1:pat2:pats3) = pats
+ pp_infix = ppr pat1 <+> ppr fun <+> ppr pat2
+
+ LambdaExpr -> (char '\\', pats)
+ other -> (empty, pats)