tweag / ormolu

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

Write with Unicode syntax when `UnicodeSyntax` is seen to be switched on? #899

Closed kindaro closed 2 years ago

kindaro commented 2 years ago

I wanted to add an option to write Unicode syntax to fourmolu and a maintainer there suggested I check with the maintainers of ormolu if this can be merged here instead. So here I am. Would you merge that pull request?

brandonchinn178 commented 2 years ago

Note: it wouldn't require an option if merged into Ormolu. It would be automatically applied, similar to how ImportQualifiedPost is automatically handled

mrkkrp commented 2 years ago

Seems to be not a very good idea if we keep in mind that the goal of a formatter is consistent appearance of the code. Some modules might end up using UnicodeSyntax and some not.

brandonchinn178 commented 2 years ago

Couldnt you say the same thing about ImportQualifiedPost today? If someone turns it on for some modules and not others, it'll format qualified imports differently.

mrkkrp commented 2 years ago

I could, I wish that feature did not exist. Frankly, it doesn't solve any real practical issue and just complicates everything for a questionable cosmetic benefit.

I think the difference is that normalizing imports is a bit more troublesome (need to edit the AST and remove a pragma), so a compromise was introduced there.