fourmolu / fourmolu

A fourk of ormolu that uses four space indentation and allows arbitrary configuration. Don't like it? PRs welcome!
https://fourmolu.github.io/
Other
356 stars 62 forks source link

Keep ADT "=" sign on first line in multi-line constructor definition #153

Open bapcyk opened 2 years ago

bapcyk commented 2 years ago

(Rewritten for clarity)

Allow formatting as

data Foo =
    Foo1
  | Foo2
  | Foo3
bapcyk commented 2 years ago

TBH the formatter does not allow comments like -- ^Setting file.... and reformat docstrings to -- |Setting file..... 😞

brandonchinn178 commented 2 years ago

Trailing comments are ticketed here: https://github.com/fourmolu/fourmolu/issues/78

We don't currently support configuring where the = sign goes. Also, putting the haddock comment before the | token is invalid; a -- | haddock comment should come immediately before the constructor being commented.

brandonchinn178 commented 2 years ago

As a side comment, I notice you've been opening a lot of these minor style issues. One of the benefits of a formatter is that you can have consistent styling that you don't have to worry about customizing to your (and other people on your team's) specific tastes. While Fourmolu does aim to be highly configurable, at some point, Fourmolu is just going to make certain decisions you might not agree with. If you prefer your code to be very tightly conformed to your personal style, a formatter might not be the best tool for you.

On a personal note, it also took some getting used to for me, as Fourmolu did some things that I also didn't agree with. But eventually, I got used to it, and the consistency of the styling (and the general uptick in readability, even at the expense of verbosity) is so much nicer than having things be styled exactly how I want it to be.

Hopefully you do end up choosing to adopt Fourmolu, and we do appreciate getting fresh eyes on some of the warts in Fourmolu's styling. But I just want to set clear expectations about what a formatter (even a highly configurable one) should do.

bapcyk commented 2 years ago

@brandonchinn178 if you want, close my issues that you recognize as irrelevant or that will never be implemented, absolutely no any problems :)

georgefst commented 2 years ago

I don't see any particular reason to close these issues (I very much do not subscribe to the idea that a project with few open issues is necessarily a healthy one, even if that seems to be somewhat in vogue given the use of "stale bots"). But realistically, if you want these style options, you will probably have to implement them yourself.

brandonchinn178 commented 1 year ago

Related: https://github.com/tweag/ormolu/issues/947