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
a
type variable inProduct f g a
has a representational role - The
f
andg
type 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 -
PolyKinds
instances ofProduct
can't currently haveEq
instances becauseEq1
can't be provided forf
because 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.