Created Started Finished
Report Eq and Ord instances that are written out Two module-level rules, `HsNoCustomEq` and `HsNoCustomOrd`, for the standard that Eq and Ord are derived. A written one says which two of these count as the same, or which of them comes first, in a body that names the fields it was written against. Add a field and the derived version accounts for it while the written one goes on answering the older question, so the type gains a field that equality ignores and sorting cannot see. ## Two rules rather than one `HsNoCustomShowRead` is one rule over two classes because Show and Read are an inverse pair: a repository that has decided to write one has decided about the round trip that is the reason for the rule. Eq and Ord do not sit like that. A type that has earned a written Ord, ordered by a key rather than by its fields in order, has usually not earned a written Eq, and one id for both would make the suppression that allows the first allow the second without anyone saying so. ## No exception for methods that discard their arguments That exception is on Show and Read because an instance printing a constant keeps a secret out of every log line and has nothing to drift from. Equality that cannot see the value is not a comparison anyone reaches for on purpose, so the same shape is reported here. `HsNoCustomEq/bad-ignoring-arguments.hs` pins it. ## originIsWrittenOut Whether a body was typed out is `originIsWrittenOut` in `Facts.Instance` rather than a copy in each rule: a stock, newtype, anyclass, via or standalone derivation is all the compiler writing against the fields. Enumerated rather than matched with a catch-all, so a further `InstanceOrigin` has to be answered for at the one site that asks. ## What to look at - `hopinion/src/Hopinion/Check/Hs/NoCustomEq/Rule.hs` and `.../NoCustomOrd/Rule.hs`, mostly the `ruleWhy` of each. - `originIsWrittenOut` in `hopinion/src/Hopinion/Facts/Instance.hs`. - The resources, in particular each `good.hs`, which is where the deriving forms that must stay quiet are listed. ## Checks `nix flake check` passes. Nothing in this repository is reported by either rule.