Ticket #4040 (closed feature request: wontfix)

Opened 3 years ago

Last modified 3 years ago

Eq instance for Data.Data.DataType

Reported by: Eelis- Owned by: igloo
Priority: normal Milestone:
Component: libraries/base Version: 6.12.2
Keywords: syb Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The DataType? data type in Data.Data currently does not derive an Eq instance, even though the types of both of its fields do have Eq instances.

Attachments

eqdatatype.patch Download (30.2 KB) - added by Eelis- 3 years ago.
trivial patch deriving the Eq instance

Change History

Changed 3 years ago by Eelis-

trivial patch deriving the Eq instance

Changed 3 years ago by dreixel

Should this instance be derived (and therefore compare both the name and the representation) or use the same approach as Constr, comparing only the representation?

See: http://www.haskell.org/ghc/dist/stable/docs/libraries/base/src/Data-Data.html#DataType

Changed 3 years ago by Eelis-

From ticket #3866 it looks like the semantics of the Eq Constr instance you refer to are considered unfortunate and are really only preserved for backward compatibility. For DataType? we have no such constraint, and I think that its Eq instance should really just do what one would expect, meaning that all the fields (rather than some subset thereof) should count.

Changed 3 years ago by simonpj

  • owner set to igloo

Changed 3 years ago by simonpj

  • status changed from new to patch

Changed 3 years ago by igloo

It feels wrong for DataType and Constr to have Eq instances that behave differently. Should we have a  library proposal to change them both to be derived?

Changed 3 years ago by igloo

  • status changed from patch to closed
  • resolution set to wontfix

I'm going to close this, as it's not clear to me what the right thing to do is, so I think a  library proposal is the right way forward.

Note: See TracTickets for help on using tickets.