This is the type class of a ring with a notion of an absolute value, satisfying the laws
a * b === b * a a /= 0 => abs (signum a) === 1 abs a * signum a === a
a + (max b c) === max (a+b) (a+c) negate (max b c) === min (negate b) (negate c) a * (max b c) === max (a*b) (a*c) where a >= 0 absOrd a === max a (-a)
We do not require
Ord as superclass
since we also want to have Number.Complex as instance.
abs for complex numbers alone may have an inappropriate type,
because it does not reflect that the absolute value is a real number.
You might prefer
This type class is intended for unifying algorithms
that work for both real and complex numbers.
Note the similarity to Algebra.Units:
abs plays the role of
signum plays the role of