tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
956 stars 83 forks source link

Empty let moves comments #917

Closed brandonchinn178 closed 1 year ago

brandonchinn178 commented 2 years ago

Describe the bug let is allowed to have no bindings, but this causes any comments later in the file to be moved into the let

To Reproduce

foo =
  let
   in 10

-- a comment
bar = 20

gets reformatted to

foo =
  let -- a comment

   in 10

bar = 20

Expected behavior Should not change

Environment

Additional context Add any other context about the problem here.