Skip to content

The -> in ViewPatterns binds more weakly than infix data constructors.

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 (closed) about overlapping patterns)

It would seem nicer to make the view pattern arrow bind tighter than any infix data constructors.

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information