summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorTakano Akio <aljee@hyper.cx>2012-08-16 11:13:47 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2012-08-16 11:13:47 +0100
commit41c7342e7937dab55d082a0c5612f783e7eaa855 (patch)
tree19c865ea2390e4720c0d61907f65399f0b2b37a9 /compiler/parser
parentde07bf2657fc5709331ad933b5563fac97b1a05b (diff)
downloadhaskell-41c7342e7937dab55d082a0c5612f783e7eaa855.tar.gz
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
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Parser.y.pp6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp
index 6c19812762..410f95bebf 100644
--- a/compiler/parser/Parser.y.pp
+++ b/compiler/parser/Parser.y.pp
@@ -1752,7 +1752,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