Hi Kevin,
On Tue, Apr 28, 2015 at 08:20:10AM -0700, Kevin Meredith wrote:
> I read over Ring's and Rig's README's, but I'm not entirely clear that
> using the `Ring` typeclass is appropriate here. Is it?
I think using a type class like Ring is the right idea. Since you only
use * and +, you could loosen the constraint to a Semiring if you
wanted.
However, since your test requires commutativity, it might be better to
use a type class which supports commutative multiplication. Currently
we don't have a commutative Semiring, but we do have CRig and CRing. I
think either of those would be a fine choice.
Alternately, you could just use Semiring and just document that you
require commutative *. Or you could even add a CSemiring type class.
Regardless, I think you have the right approach here -- it's a matter
of zeroing in on which type class you want to use.
-- Erik