From 21fd2310c1671a596d39cbe336929c6eebeca566 Mon Sep 17 00:00:00 2001
From: Takano Akio <aljee@hyper.cx>
Date: Wed, 15 Aug 2012 14:07:20 +0900
Subject: [PATCH] Parser: allow a field binding to have a texp
This allows placing a view pattern or a bang pattern
directly inside a record pattern. For example,
data Rec = Rec { fld :: Int }
f Rec{ fld = !x } = x
g Rec{ fld = show -> y } = y
---
compiler/parser/Parser.y.pp | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp
index 6c19812..0fa2c40 100644
|
a
|
b
|
|
| 1752 | 1752 | | '..' { ([], True) } |
| 1753 | 1753 | |
| 1754 | 1754 | fbind :: { HsRecField RdrName (LHsExpr RdrName) } |
| 1755 | | : qvar '=' exp { HsRecField $1 $3 False } |
| 1756 | | | qvar { HsRecField $1 placeHolderPunRhs True } |
| 1757 | | -- In the punning case, use a place-holder |
| 1758 | | -- The renamer fills in the final value |
| | 1755 | : qvar '=' texp { HsRecField $1 $3 False } |
| | 1756 | | qvar { HsRecField $1 placeHolderPunRhs True } |
| | 1757 | -- In the punning case, use a place-holder |
| | 1758 | -- The renamer fills in the final value |
| 1759 | 1759 | |
| 1760 | 1760 | ----------------------------------------------------------------------------- |
| 1761 | 1761 | -- Implicit Parameter Bindings |