hindent icon indicating copy to clipboard operation
hindent copied to clipboard

Support deriving stock (-Wmissing-deriving-strategies)

Open bergmark opened this issue 4 years ago • 0 comments

Completed checklist

  • [x] I've checked the issue tracker for similar issues.
  • [x] I am not creating an issue about adding more configuration options for the styling/layout of hindent, because hindent is not about customizing style.

Problem description

$ cat Test.hs

data X deriving stock Generic

$ hindent Test.hs $ cat Test.hs

data X
  deriving  (Generic)

(sic! two spaces in deriving (Generic))

Proposed solution

Don't remove stock if present. Removing it triggers -WMissing-deriving-strategies if enabled. I like being explicit about it to remove potential confusion on how the instance is being derived. This solution will not cause a diff for anyone upgrading.

Alternatives

  • Always add stock => not backwards compatible and will cause diffs.
  • Don't do anything and keep things as is => 😿

bergmark avatar Feb 15 '21 18:02 bergmark