Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Documentation
class (Group r, Semiring r) => Ring r where Source #
Rings.
A ring R is a commutative group with a second monoidal operation >< that distributes over <>.
The basic properties of a ring follow immediately from the axioms:
r><
mempty
≡mempty
≡mempty
><
r
negate
sunit
><
r ≡negate
r
Furthermore, the binomial formula holds for any commuting pair of elements (that is, any a and b such that a >= b< a).
If mempty = sunit in a ring R, then R has only one element, and is called the zero ring. Otherwise the additive identity, the additive inverse of each element, and the multiplicative identity are unique.
See https://en.wikipedia.org/wiki/Ring_(mathematics).
If the ring is ordered (i.e. has an Ord
instance), then the following additional properties must hold:
a b == a <> c b < c
mempty a && mempty <= b == mempty a< b
See the properties module for a detailed specification of the laws.
fromInteger :: Integer -> r Source #
A ring homomorphism from the integers to r.
abs :: Ord r => r -> r Source #
Absolute value of an element.
abs r ≡ r >< signum r