-
Notifications
You must be signed in to change notification settings - Fork 92
Closed
Description
After #128, we now have a couple of small problems:
Field
is exactlyCommutativeRing
andDivisionRing
; forcing people to declare an extraField
instance doesn't really add anything.Field
should haveDivisionRing
as a subclass, since everyField
is aDivisionRing
.
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?)
Metadata
Metadata
Assignees
Labels
No labels