Stop generating redundant parens in 'deriving' code
[ghc-hetmet.git] / compiler / hsSyn / HsUtils.lhs
index 667f8cc..d793a3b 100644 (file)
@@ -338,9 +338,8 @@ mkMatch pats expr binds
   = noLoc (Match (map paren pats) Nothing 
                 (GRHSs (unguardedRHS expr) binds))
   where
-    paren p = case p of
-               L _ (VarPat _) -> p
-               L l _          -> L l (ParPat p)
+    paren lp@(L l p) | hsPatNeedsParens p = L l (ParPat lp) 
+                    | otherwise          = lp
 \end{code}