cabal-fmt icon indicating copy to clipboard operation
cabal-fmt copied to clipboard

`ghc-options` should be listed one-per-line

Open elldritch opened this issue 3 years ago • 1 comments

Currently, ghc-options are listed as a wrapped text blob. For example, take this excerpt:

common lang
  build-depends:      base >=4.12 && <4.15
  default-language:   Haskell2010
  default-extensions:
    BangPatterns
    BinaryLiterals
    -- ...

  ghc-options:
    -Wall -Wincomplete-uni-patterns -Wcompat
    -Wincomplete-record-updates -Wmissing-home-modules
    -Wmissing-export-lists -Wmissing-import-lists
    -Wredundant-constraints

I like that cabal-fmt puts each language extension in default-extensions on a separate line, since this minimizes diffs when we change the extension list. I wish cabal-fmt also put each option in ghc-options on a separate line to likewise minimize diffs:

  ghc-options:
    -Wall
    -Wincomplete-uni-patterns
    -Wcompat
    -Wincomplete-record-updates
    -Wmissing-home-modules
    -Wmissing-export-lists
    -Wmissing-import-lists
    -Wredundant-constraints

elldritch avatar Aug 16 '21 18:08 elldritch

This should be configurable. I don't like one flag per line, but if someone wants to put the work in, be my guest.

phadej avatar Sep 21 '22 12:09 phadej