Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class Num a => CommutativeProduct a
Documentation
class Num a => CommutativeProduct a Source #
Subclass of Num
where (*)
is commutative.
Num
doesn't demand commutative (*)
, and there are reasonable
"real-world" instances with non-commutative multiplication. There
is also no canonical subclass in base
that would suffice, as both
Integral
and Floating
imply commutative (*)
for different
reasons.
Two examples of non-commutative (*)
:
Linear.Quaternion.Quaterion
from thelinear
package has aNum
instance, and quaternion multiplication is noncommutative.Data.Matrix.Matrix
from thematrix
package uses(*)
for matrix multiplication, which is also non-commutative (on square matrices, which is the only time the question makes sense).
Since: 0.1.0