After #128, we now have a couple of small problems:
Field is exactly CommutativeRing and DivisionRing; forcing people to declare an extra Field instance doesn't really add anything.
Field should have DivisionRing as a subclass, since every Field is a DivisionRing.
As far as I can tell, there are two options for addressing this:
Option 1: Change Field as follows:
class (DivisionRing a, CommutativeRing a) <= Field a
instance field :: (DivisionRing a, CommutativeRing a) => Field a
So that no additional Field instances should be declared anywhere, and instead the single Field instance allows people to use a Field constraint wherever a type has both DivisionRing and CommutativeRing instances. If we did this, it would only be a breaking change for people who had declared Field instances for types in their own code; functions with Field constraints should continue to work as before.
Option 2: Wait for constraint kinds and define Field in terms of a class class Both (a :: Constraint) (b :: Constraint) (is that accurate?)
After #128, we now have a couple of small problems:
Fieldis exactlyCommutativeRingandDivisionRing; forcing people to declare an extraFieldinstance doesn't really add anything.Fieldshould haveDivisionRingas a subclass, since everyFieldis aDivisionRing.As far as I can tell, there are two options for addressing this:
Option 1: Change
Fieldas follows:So that no additional
Fieldinstances should be declared anywhere, and instead the singleFieldinstance allows people to use aFieldconstraint wherever a type has bothDivisionRingandCommutativeRinginstances. If we did this, it would only be a breaking change for people who had declaredFieldinstances for types in their own code; functions withFieldconstraints should continue to work as before.Option 2: Wait for constraint kinds and define
Fieldin terms of a classclass Both (a :: Constraint) (b :: Constraint)(is that accurate?)