non-diff-friendly behavior with `$`
Describe the bug
The positioning of $ changes depending other line breaks in the expression.
To Reproduce
shortExpr $
otherExpr
Now add a composition before the application:
shortExpr . composedExpr $
otherExpr
So far, so good, but if composedExpr makes the line too long, I break it:
shortExpr
. composedExpr $
otherExpr
Then Ormolu reformats it like
shortExpr
. composedExpr
$ otherExpr
changing the otherExpr line, which was previously diff-clean. This seems to go against the diff-friendliness of Ormolu. Also, AFAICT, it's special handling of $ -- other operators seem to always be after a line break, but I'm not sure if that's true or if there's a subtle distinction I'm missing.
Expected behavior Probably, I expect the first expression above to be formatted
shortExpr
$ otherExpr
keeping the second line stable no matter how long the expression before it gets. In fact, this formatting keeps both the shortExpr and otherExpr line clean, and the current behavior makes them both dirty.
Environment
- OS name + version: NixOS 20.03
- Version of the code: 0.3.1
Additional context
This got worse recently, with every added foo $ in the pipeline shifting the subsequent expression block by two chars.
foo =
x $
y $ do
a
b
This got worse recently
The example may look ugly with single-letter names, but IMO that's on single-letter names.
reasonably =
namedWrapper $
doingSomeStuff $ do
this
that
Sure. The problem is that I can't choose whether I want namedWrapper $ doingSomeStuff $ do to be on one line or two lines. I have to replace $ with ..
No wait, nevermind, that's an unrelated problem.