Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize tests related to operators #619

Merged
merged 10 commits into from
Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 60 additions & 58 deletions TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,45 +545,6 @@ strToMonth month =
_ -> error $ "Unknown month " ++ month
```

Operators, bad

``` haskell
x =
Value <$> thing <*> secondThing <*> thirdThing <*> fourthThing <*>
Just thisissolong <*>
Just stilllonger <*>
evenlonger
```

Operators, good

```haskell pending
x =
Value <$> thing <*> secondThing <*> thirdThing <*> fourthThing <*>
Just thisissolong <*> Just stilllonger <*> evenlonger
```

Operator with `do`

```haskell
for xs $ do
left x
right x
```

Operator with lambda-case

```haskell
for xs $ \case
Left x -> x
```

Operator in parentheses

```haskell
cat = (++)
```

Symbol data constructor in parentheses

```haskell
Expand Down Expand Up @@ -777,6 +738,66 @@ fun xs ys =
]
```

### Operators

Bad

```haskell
x =
Value <$> thing <*> secondThing <*> thirdThing <*> fourthThing <*>
Just thisissolong <*>
Just stilllonger <*>
evenlonger
```

Good

```haskell pending
x =
Value <$> thing <*> secondThing <*> thirdThing <*> fourthThing <*>
Just thisissolong <*> Just stilllonger <*> evenlonger
```

With `do`

```haskell
for xs $ do
left x
right x
```

With lambda-case

```haskell
for xs $ \case
Left x -> x
```

In parentheses

```haskell
cat = (++)
```

The first character of an infix operator can be `@` unless `TypeApplications` is enabled.

```haskell
-- https://github.com/mihaimaruseac/hindent/issues/421
a @: b = a + b

main = print (2 @: 2)
```

A data constructor enclosed by parentheses

```haskell
-- https://github.com/mihaimaruseac/hindent/issues/422
data T a =
a :@ a

test = (:@)
```

### Records

Short
Expand Down Expand Up @@ -1754,25 +1775,6 @@ TimoFreiberg INLINE (and other) pragmas for operators are reformatted without pa
{-# NOINLINE (<>) #-}
```

andersk Cannot parse @: operator #421

```haskell
-- https://github.com/commercialhaskell/hindent/issues/421
a @: b = a + b

main = print (2 @: 2)
```

andersk Corrupts parenthesized type operators #422

```haskell
-- https://github.com/commercialhaskell/hindent/issues/422
data T a =
a :@ a

test = (:@)
```

NorfairKing Infix constructor pattern is broken #424

```haskell
Expand Down