Re: [GHC] #2742: The - in ViewPatterns binds more weakly than infix data constructors.
#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 Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #2742: The - in ViewPatterns binds more weakly than infix data constructors.
#2742: The - in ViewPatterns binds more weakly than infix data constructors. -+-- Reporter: guest | Owner: Type: bug | Status: new Priority: normal| Component: Compiler Version: 6.10.1|Severity: normal Keywords:|Testcase: Architecture: Unknown/Multiple | Os: Unknown/Multiple -+-- The following code, essentially taken from the ViewPatterns page on the wiki doesn't seem to parse correctly. {{{ mymap f [] = [] mymap f (x : mymap f - xs) = f x : xs }}} However, this does: {{{ mymap f [] = [] mymap f (x : (mymap f - xs)) = f x : xs }}} (though it triggers bug #2395 about overlapping patterns) It would seem nicer to make the view pattern arrow bind ''tighter'' than any infix data constructors. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2742 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2742: The - in ViewPatterns binds more weakly than infix data constructors.
#2742: The - in ViewPatterns binds more weakly than infix data constructors. -+-- Reporter: guest |Owner: Type: bug | Status: new Priority: normal|Milestone: Component: Compiler | Version: 6.10.1 Severity: normal| Resolution: Keywords:| Testcase: Architecture: Unknown/Multiple | Os: Unknown/Multiple -+-- Changes (by guest): * cc: [EMAIL PROTECTED] (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2742#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs