From 038bec8abc35114e15c2d870f860025b0d7e3baa Mon Sep 17 00:00:00 2001
From: Takano Akio <aljee@hyper.cx>
Date: Thu, 16 Aug 2012 11:13:47 +0100
Subject: [PATCH] Allow a vew pattern or bang pattern in a record pattern.

e.g.
        data T = MkT { x,y :: Int }

        f (MkT { x = !v, y = negate -> w }) = v + w

MERGED from commit 41c7342e7937dab55d082a0c5612f783e7eaa855
---
 compiler/parser/Parser.y.pp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp
index 62132277d914..a4c08c196eae 100644
--- a/compiler/parser/Parser.y.pp
+++ b/compiler/parser/Parser.y.pp
@@ -1751,7 +1751,11 @@ fbinds1 :: { ([HsRecField RdrName (LHsExpr RdrName)], Bool) }
         | '..'                          { ([],   True) }
   
 fbind   :: { HsRecField RdrName (LHsExpr RdrName) }
-        : qvar '=' exp  { HsRecField $1 $3                False }
+        : qvar '=' texp { HsRecField $1 $3                False }
+                        -- RHS is a 'texp', allowing view patterns (Trac #6038)
+                        -- and, incidentaly, sections.  Eg
+                        -- f (R { x = show -> s }) = ...
+
         | qvar          { HsRecField $1 placeHolderPunRhs True }
                         -- In the punning case, use a place-holder
                         -- The renamer fills in the final value
-- 
GitLab