Skip to content

Clean up numeric hierarchy #132

@hdgarrood

Description

@hdgarrood

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?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions