Classes corresponding to common structures from abstract algebra.
- class AbelianGroup a where
- class AbelianGroup a => Ring a where
- class (Eq a, Ring a) => EuclideanDomain a where
- class Ring a => Field a where
- subtract :: AbelianGroup a => a -> a -> a
- gcd :: EuclideanDomain a => a -> a -> a
- lcm :: EuclideanDomain a => a -> a -> a
- realToField :: (Real a, Field b) => a -> b
An Abelian group has an commutative associative binary operation with an identity and inverses.
The identity of
A commutative associative operation with identity
( (unary negation).
|EuclideanDomain a => AbelianGroup (Ratio a)|
|AbelianGroup a => AbelianGroup (Complex a)|
|AbelianGroup a => AbelianGroup (Vector a)|
|AbelianGroup a => AbelianGroup (Matrix a)|
|AbelianGroup a => AbelianGroup (Polynomial a)|
|(AbelianGroup a, AbelianGroup b) => AbelianGroup (a, b)|
|AbelianGroup a => AbelianGroup (Quantity u a)|
A ring: addition forms an Abelian group, and multiplication defines a monoid and distributes over addition. Multiplication is not guaranteed to be commutative.
Division with remainder: for any
d /= 0,
is smaller than
din some well-founded order.
For integral types,
is a non-negative integer smaller
than the absolute value of
mod n d
|Integral a => EuclideanDomain (Complex a)|
|(Eq a, Field a) => EuclideanDomain (Polynomial a)|
Ring in which all non-zero elements have multiplicative