Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ormolu compatibility #38

Open
georgefst opened this issue Oct 1, 2020 · 2 comments
Open

Ormolu compatibility #38

georgefst opened this issue Oct 1, 2020 · 2 comments

Comments

@georgefst
Copy link
Collaborator

georgefst commented Oct 1, 2020

Currently, behaviour deviates from Ormolu (with this config) in the following ways:

  • Stop operators from being indented past do. #6: Changes a specific rare edge case (do block as the left operand of an infix operator), where Ormolu + 4-space indentation causes an unsafe formatting (modified AST).
  • Use multiline comment style for multiline haddocks #30: In single-line mode, we don't insert leading spaces:
    {- | haddock
    comment
    -}
    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.
  • Fix nested lists etc. #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.

@brandonchinn178
Copy link
Collaborator

TODO: Maybe move this into a Wiki page?

@georgefst
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants