non/spire — pull request #296 by denisrosset (2014-08-05 13:53:42+00:00)
Title: Add isId, isZero, isOne to Monoid, AdditiveMonoid and MultiplicativeMonoid.

It would be good for performance to be able to tell quickly is a monoid element is the identity.

I have an use case when dealing with computational group theory: an element is decomposed as a product of transversals, until the identity is left. I have the option of defining my own type class extending Monoid, or to push some changes here.

Main difficulty: nearly every class in Spire needs to be extended (I have around 238 compilations errors right now for missing methods). Provided I can get some help for tricky cases (such as the tuples auto-generated code), I'm motivated to do it.

Note: the addition of isId to Monoid requires the addition of isZero and isOne, by the virtue of monoid conversion from and to additive/multiplicative monoids.