Commit 038bec8a authored by aljee@hyper.cx's avatar aljee@hyper.cx Committed by pcapriotti
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

MERGED from commit 41c7342e
parent 8c668678
......@@ -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
......
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