Skip to content

Re-add DivisionRing? #128

@hdgarrood

Description

@hdgarrood

I am working on a quaternion library and I was wondering if it might make sense to add a DivisionRing type class again, as follows:

class Ring a <= DivisionRing a where
  recip :: a -> a

with the law that x * recip x = recip x * x = one for all nonzero x. There's no requirement for the ring to be commutative, and so this would allow us to provide a DivisionRing Quaternion instance.

If we were going to do this, we should change Field so that DivisionRing is a subclass as well.

Now of course with any EuclideanRing you can simply write one / x for recip x. Also, admittedly, the only 'useful' instance I can think of is Quaternion; I did some googling and wasn't really able to find any other useful examples of non-commutative division rings. But I think it would be nice to have a way of asking for the multiplicative inverse of an element of an arbitrary division ring without requiring it to be commutative.

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