fourmolu
fourmolu copied to clipboard
Ormolu compatibility
Currently, behaviour deviates from Ormolu (with this config) in the following ways:
- #6: Changes a specific rare edge case (
doblock as the left operand of an infix operator), where Ormolu + 4-space indentation causes an unsafe formatting (modified AST).- EDIT: possibly related to https://github.com/tweag/ormolu/issues/528
- #30: In
single-linemode, we don't insert leading spaces:
becomes:{- | haddock comment -}
rather than:-- | haddock --comment
Replicating Ormolu's behaviour here would be possible. The implementation would just get very messy. Besides, we still have the property that we won't modify code which has already been formatted by Ormolu. And I'm admittedly a bit ambivalent because I really can't see the argument for replacing multi-line comments with multiple single-line ones in the first place.-- | haddock -- comment - #37: The fact that we round down upon indenting means that some lines which wouldn't start in an even column with Ormolu do with Fourmolu. I'm yet to find an example of this which looks like code any human would actually write.
Each of these changes has elements which it may be worth at least attempting to upstream.
TODO: Maybe move this into a Wiki page?
TODO: Maybe move this into a Wiki page?
Perhaps. Ideally I'd like to just get rid of each inconsistency. But that might not happen any time soon.