Ring encapsulates the mathematical structure
of a (not necessarily commutative) ring, with the laws
a * (b * c) === (a * b) * c
one * a === a
a * one === a
a * (b + c) === a * b + a * c
Typical examples include integers, polynomials, matrices, and quaternions.
Minimal definition: *, (one or fromInteger)
The exponent has fixed type Integer in order
to avoid an arbitrarily limitted range of exponents,
but to reduce the need for the compiler to guess the type (default type).
In practice the exponent is most oftenly fixed, and is most oftenly 2.
Fixed exponents can be optimized away and
thus the expensive computation of Integers doesn't matter.
The previous solution used a Algebra.ToInteger.C constrained type
and the exponent was converted to Integer before computation.
So the current solution is not less efficient.
A variant of ^ with more flexibility is provided by Algebra.Core.ringPower.
|scalarProduct :: C a => [a] -> [a] -> a||Source|
|propRightDistributive :: (Eq a, C a) => a -> a -> a -> Bool||Source|
|Commutativity need not be satisfied by all instances of C.
|Produced by Haddock version 2.6.0|