snoyberg / mono-traversable

Type classes for mapping, folding, and traversing monomorphic containers
152 stars 61 forks source link

Remove whitespace after '@' in as-patterns #186

Closed RyanGlScott closed 4 years ago

RyanGlScott commented 4 years ago

Currently, mono-traversable has these two lines of code:

https://github.com/snoyberg/mono-traversable/blob/cf3858a4a67859be1518549e06c6976345970396/mono-traversable/src/Data/MonoTraversable.hs#L1317

https://github.com/snoyberg/mono-traversable/blob/cf3858a4a67859be1518549e06c6976345970396/mono-traversable/src/Data/MonoTraversable.hs#L1327

Notice the space after the @ in each as-pattern. As of GHC proposal #229, this is a parse error, which means that mono-traversable fails to compile on GHC HEAD:

src/Data/MonoTraversable.hs:1317:16: error:
    Suffix occurrence of @. For an as-pattern, remove the leading whitespace.
     |
1317 |     oextend f w@ ~(_ :< xxs) =
     |                ^

This is easily fixed in a backwards-compatible way by removing the whitespace and adding an extra set of parentheses, which this patch accomplishes. (This is the same patch that is present in head.hackage.)