haskell / haskell/stylish-haskell

Top level patterns are not aligned when an expression is longer than the column limit.

Open
#373 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

Assume column limit is set to 80 (the default).

For a top level function that uses pattern matching-
```hs
f (x:xs) = undefined
f n@(x:y:z:rest) = undefined
f (x:y:rest) = undefined
```

Running stylish-haskell correctly formats it to-
```hs
f (x:xs) = undefined
f n@(x:y:z:rest) = undefined
f (x:y:rest) = undefined
```

However, if one of the alternatives is longer than the column limit, no formatting is performed-
```hs
f (x:xs) = undefined undefined undefined undefined undefined undefined undefined
f n@(x:y:z:rest) = undefined
f (x:y:rest) = undefined
```

I understand that simple alignment is supposed to apply "only to statements where each element occupies a single line" - but does this not count as "single line"?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.