Ticket #6038: 0001-Parser-allow-a-field-binding-to-have-a-texp.patch

File 0001-Parser-allow-a-field-binding-to-have-a-texp.patch, 1.5 KB (added by akio, 20 months ago)

use texp

  • compiler/parser/Parser.y.pp

    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 fbinds1 :: { ([HsRecField RdrName (LHsExpr RdrName)], Bool) } 
    17521752        | '..'                          { ([],   True) } 
    17531753   
    17541754fbind   :: { 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 
    17591759 
    17601760----------------------------------------------------------------------------- 
    17611761-- Implicit Parameter Bindings