Formatter incorrectly removes whitespace, creating new identifiers
jlebar opened this issue · comments
Maybe I'm doing something wrong (I am new to Haskell), but the formatter seems to be making some...rather drastic semantic changes to the following code. :)
Input:
chunks n = []
f :: Integer -> Integer -> Integer -> Integer -> Integer
f x y a b = 0
g = map (\ (x:y:a:b:rem) -> f x y a b) . chunks 4 . tail . map read . words
Output:
chunks n = []
f :: Integer -> Integer -> Integer -> Integer -> Integer
f x y a b = 0
g = map (\ (x : y: a: b :rem ) ->fx y a b ).chunks
4 . tail. mapread. words
Note that in particular, we now have identifiers fx
and mapread
, which don't exist.
Not sure how to get a version out of haskell-formatter (there doesn't seem to be a -v), but I just installed it from stack.
Thanks for reporting this. That looks terrible – clearly a bug.
I can reproduce this with the latest version 2.0.2 (there is currently no option to print the version).
This project has stagnated for now, unfortunately. You may be best served with one of the alternatives. My personal favorite is hindent.
Don't let this distract you from your Haskell journey. Have fun.