| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Ring
Documentation
class (Group a, Semiring a) => Ring a 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
negatesunit><r ≡negater
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.
Minimal complete definition
Methods
fromInteger :: Integer -> a Source #
A ring homomorphism from the integers to a.
abs :: Ord a => a -> a Source #
Absolute value of an element.
abs r ≡ r >< signum r
Instances
| Ring Int Source # | |
| Ring Int8 Source # | |
| Ring Int16 Source # | |
| Ring Int32 Source # | |
| Ring Int64 Source # | |
| Ring Integer Source # | |
| Ring Rational Source # | |
| Ring Uni Source # | |
| Ring Deci Source # | |
| Ring Centi Source # | |
| Ring Milli Source # | |
| Ring Micro Source # | |
| Ring Nano Source # | |
| Ring Pico Source # | |
| Ring a => Ring (Complex a) Source # | |
| Ring a => Ring (Quaternion a) Source # | |
Defined in Data.Semifield.Quaternion Methods fromInteger :: Integer -> Quaternion a Source # abs :: Quaternion a -> Quaternion a Source # signum :: Quaternion a -> Quaternion a Source # | |