Closed MonoidMusician closed 6 years ago
This doesn't quite work because of the zero
element - I think we'd need some other NonZeroMultiplicative
newtype with a constructor which ensures that the thing it contains is not zero
.
Only groupMultiplicative
doesn't work here... The Commutative
does, no? And the relaxing of commutativeAdditive
makes sense as well, to me.
Yep, I think the commutativeAdditive
and commutativeMultiplicative
instances are good.
I don't see any issues with this. For me it looks good to merge. Anybody disagree?
Looks right to me.
Thanks for the contribution @MonoidMusician !
Yes, thanks for the feedback from all of you! I think NonZeroMultiplicative
is a good idea, I’ll remember to submit a PR for that later.
NonZeroMultiplicative = the multiplicative group of the non-zero elements of a division ring?
Yep, exactly. On reflection I think NonZero
might be a better name, as the Group
instance using multiplication is kind of obvious, or at least the only remaining sensible option; you no longer have the zero element so it couldn’t possibly be using addition.
I was going through the hierarchies and noticed that
DivisionRing
should be able to provideginverse
forMultiplicative
. (I think this is correct – we shouldn't need a full (commutative) field, but a field should furnish a commutative group I think.)Also I relaxed
commutativeAdditive
to only need aSemiring
. Addition is always commutative in the hierarchy so might as well require just the base class :)