ennocramer / floskell

Floskell is a flexible Haskell source code pretty printer.
BSD 3-Clause "New" or "Revised" License
178 stars 22 forks source link

Extra blank line between type signature and definition when separated by comment #61

Closed jdygert closed 1 year ago

jdygert commented 3 years ago

I'm not sure if this is intentional, but it seems unnecessary to me, and I didn't see an option to prevent this.

f :: ()
--
f = ()

becomes

f :: ()

--
f = ()

and

f :: () -- ^
f = ()

becomes

f :: () -- ^

f = ()

This also seems inconsistent with not having a blank line before a comment on successive patterns:

f :: Bool -> ()

--
f True = ()
--
f False = ()
ennocramer commented 3 years ago

This is indeed not intentional, but a result of the extremely simple spacing heuristic. The code simply sees the type signature and definition to not be adjacent and thus inserts an empty line. It does not realize that the space was actually filled with a comment and it's thus inserting a vertical separation that wasn't there before.

ennocramer commented 1 year ago

This was fixed in floskell-0.10.6.