morganthomas / purescript-group

Algebraic groups for PureScript.
Apache License 2.0
6 stars 6 forks source link

Remove CommutativeGroup and add CommutativeSemigroup #2

Closed rightfold closed 7 years ago

rightfold commented 7 years ago

Then if you want a commutative group you specify two constraints. The benefit is that you can have commutative monoids which have quite a lot of use cases.

I think for brevity it should be called Commutative.

There could be a type alias for Abelian groups like so:

type Abelian a b = Group a => Commutative a => b

Then to require an Abelian group and other constraints, you can write something like this:

f :: forall a. Abelian a (Eq a => a -> Int)
morganthomas commented 7 years ago

Hi @rightfold !

My apologies for the delay in responding to this. It was due to forgetting about this before I followed up. I will try to have shorter delays in the future.

I agree with your suggestion and I'm happy if you implement it. In addition, since I believe you know what you're doing and your interest in this project seems to be greater than mine at the moment, I will give you edit privileges on the repository so you can make further improvements as you see fit.

morganthomas commented 7 years ago

Nice, thank you for making this improvement, @rightfold !