#2742: The -> in ViewPatterns binds more weakly than infix data constructors.
---------------------------------+------------------------------------------
    Reporter:  guest             |        Owner:                  
        Type:  feature request   |       Status:  new             
    Priority:  normal            |    Milestone:  _|_             
   Component:  Compiler          |      Version:  6.10.1          
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * difficulty:  => Unknown
  * type:  bug => feature request
  * milestone:  => _|_

Comment:

 I agree with you.  Here's why it's tricky.  Haskell allows a pattern like
 this
 {{{
   case x of
      a:as -> rhs
 }}}
 If view patterns bind more tightly than infix ops, then presumably this
 would be ok
 {{{
   case x of
      a : f as -> bs -> rhs
 }}}
 and now we get an awkward ambiguity between the two uses of `->`.

 The change I made to the parser was this:
  * Remove this production from `texp`:
 {{{
         | fexp '->' exp   { LL $ EViewPat $1 $3 }
 }}}
  * Add the same production to `exp10`.

 That added a new shift/reduce conflict, described above, which gets
 resolved the wrong way.

 If someone wants to investigate alternatives, that'd be great, so I'll
 leave this open as a feature request.  It's a pure parser question so it
 does not require deep GHC knowledge.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2742#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to