Skip to content

Commit

Permalink
Remove whitespace after '@' in as-patterns
Browse files Browse the repository at this point in the history
Currently, `mono-traversable` has these two lines of code:

```hs
    oextend f w@ ~(_ :< xxs) =
```
```hs
    oextend f w@ ~(xxs :> _) =
```

Notice the space after the `@` in each as-pattern. As of GHC proposal
[#229](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0229-whitespace-bang-patterns.rst),
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.
  • Loading branch information
RyanGlScott committed Dec 24, 2019
1 parent cf3858a commit 005c1e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mono-traversable/src/Data/MonoTraversable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ class MonoFunctor mono => MonoComonad mono where
instance MonoComonad (ViewL a) where
oextract ~(x :< _) = x
{-# INLINE oextract #-}
oextend f w@ ~(_ :< xxs) =
oextend f w@(~(_ :< xxs)) =
f w :< case Seq.viewl xxs of
EmptyL -> Seq.empty
xs -> case oextend f xs of
Expand All @@ -1324,7 +1324,7 @@ instance MonoComonad (ViewL a) where
instance MonoComonad (ViewR a) where
oextract ~(_ :> x) = x
{-# INLINE oextract #-}
oextend f w@ ~(xxs :> _) =
oextend f w@(~(xxs :> _)) =
(case Seq.viewr xxs of
EmptyR -> Seq.empty
xs -> case oextend f xs of
Expand Down

0 comments on commit 005c1e3

Please sign in to comment.