tweag / ormolu

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

idempotence bug when formatting some files #542

Closed Munksgaard closed 4 years ago

Munksgaard commented 4 years ago

I'm evaluating formatters for the Futhark project, and upon trying ormolu the files in that project, the following five files exhibited idempotency bugs in ormolu:

https://github.com/diku-dk/futhark/blob/b407b5323c4cef993f18e76cc3ada00d84679428/src/Futhark/Representation/AST/Pretty.hs https://github.com/diku-dk/futhark/blob/b407b5323c4cef993f18e76cc3ada00d84679428/src/Futhark/Analysis/HORepresentation/SOAC.hs https://github.com/diku-dk/futhark/blob/b407b5323c4cef993f18e76cc3ada00d84679428/src/Futhark/Optimise/Fusion.hs https://github.com/diku-dk/futhark/blob/b407b5323c4cef993f18e76cc3ada00d84679428/src/Language/Futhark/TypeChecker/Terms.hs https://github.com/diku-dk/futhark/blob/b407b5323c4cef993f18e76cc3ada00d84679428/src/Language/Futhark/TypeChecker/Unify.hs

Most of them seem to have to do with <> and <+> operators (and thus could be related to https://github.com/tweag/ormolu/issues/451), but in SOAC.hs and Fusion.hs, there also seem to be comments that are incorrectly formatted the second time around.

Munksgaard commented 4 years ago

Forgot to mention that I'm using ormolu from nixos-unstable:

$ ormolu --version
ormolu 0.0.3.1 UNKNOWN UNKNOWN
using ghc-lib-parser 8.8.3.20200224
mrkkrp commented 4 years ago

How this is different from the existing tickets?

Munksgaard commented 4 years ago

Ah, it's probably not. I hadn't seen you also had tickets regarding comments. Thanks for your work!