lspitzner / lspitzner/brittany
Very long type signatures are not dealt with well
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 686
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following type signature. Under the default settings, brittany version `0.12.1.1` does:
```haskell
xxx
:: forall c0 c1 c2 c3 c4 c5 c6 c7 c8 c9
. c0 Integer
-> c1 Integer
-> c2 Integer
-> c3 Integer
-> c4 Integer
-> c5 Integer
-> c6 Integer
-> c7 Integer
-> c8 Integer
-> c9 Integer
-> c0 Integer
-> c1 Integer
-> c2 Integer
-> c3 Integer
-> c4 Integer
-> c5 Integer
-> c6 Integer
-> c7 Integer
-> c8 Integer
-> c9 Integer
xxx = undefined
```
Not great, but not terrible. However if you extend the type signature by just a little bit more:
```haskell
xxx
:: forall
c0
c1
c2
c3
c4
c5
c6
c7
c8
c9
. c0 Integer
-> c1 Integer
-> c2 Integer
-> c3 Integer
-> c4 Integer
-> c5 Integer
-> c6 Integer
-> c7 Integer
-> c8 Integer
-> c9 Integer
-> c0 Integer
-> c1 Integer
-> c2 Integer
-> c3 Integer
-> c4 Integer
-> c5 Integer
-> c6 Integer
-> c7 Integer
-> c8 Integer
-> c9 Integer
-> c0 Integer
-> c1 Integer
-> c2
Integer
-> c3
Integer
-> c4
Integer
-> c5
Integer
-> c6
Integer
-> c7
Integer
-> c8
Integer
-> c9
Integer
```
Wow, what has happened here? Why all the extra unnecessary line breaks???
(Yes, regrettably my "real use-case" signature is similar, I am coding with dependent types. :disappointed: )
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the two Haskell type signatures shown, using brittany 0.12.1.1 and default settings, and compare the formatter output. Trace the formatting path for long forall and function type signatures; done means the extended signature no longer gains unnecessary line breaks while remaining valid and readable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100