You need to sign in or sign up before continuing.
More general Eq+Ord+Read+Show instances for Data.Functor.Product
Motivation
Data.Functor.Product currently has instances for Eq, Ord, Read, and Show which are based on Eq1, Ord1, Read1, and Show1, which implicitly assume that:
- The
atype variable inProduct f g ahas a representational role - The
fandgtype variables have kindType -> Type
These assumptions are not always correct, for example:
- There's no reason that
Eq (Product (Const Int) (Const Bool) a)should requireEq a, but it does -
PolyKindsinstances ofProductcan't currently haveEqinstances becauseEq1can't be provided forfbecause it has the wrong kind
When needing these instances, the problem currently cannot be worked around using orphan instances, as those overlap the original instances.
Proposal
Replace the current limited Eq, Ord, Read, and Show instances of Product with more general instances.
This is a matter of simply removing the current instances and adding , Eq, Ord, Read, Show to Product's deriving clause.