Commit 41c7342e authored by aljee@hyper.cx's avatar aljee@hyper.cx Committed by Simon Peyton Jones
Browse files

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
parent de07bf26
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment