rings-0.0.2.4: Ring-like objects.

Safe HaskellSafe
LanguageHaskell2010

Data.Ring

Synopsis

Documentation

(<<) :: Group a => a -> a -> a infixl 6 Source #

(><) :: Semiring a => a -> a -> a infixl 7 Source #

Multiplicative operation.

(<>) :: Semigroup a => a -> a -> a infixr 6 #

An associative operation.

negate :: Group a => a -> a Source #

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 >< memptymemptymempty >< 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.

Minimal complete definition

fromInteger

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

signum :: Ord a => a -> a Source #

Instances
Ring Int Source # 
Instance details

Defined in Data.Ring

Ring Int8 Source # 
Instance details

Defined in Data.Ring

Ring Int16 Source # 
Instance details

Defined in Data.Ring

Ring Int32 Source # 
Instance details

Defined in Data.Ring

Ring Int64 Source # 
Instance details

Defined in Data.Ring

Ring Integer Source # 
Instance details

Defined in Data.Ring

Ring Rational Source # 
Instance details

Defined in Data.Ring

Ring Uni Source # 
Instance details

Defined in Data.Ring

Ring Deci Source # 
Instance details

Defined in Data.Ring

Ring Centi Source # 
Instance details

Defined in Data.Ring

Ring Milli Source # 
Instance details

Defined in Data.Ring

Ring Micro Source # 
Instance details

Defined in Data.Ring

Ring Nano Source # 
Instance details

Defined in Data.Ring

Ring Pico Source # 
Instance details

Defined in Data.Ring

Ring a => Ring (Complex a) Source # 
Instance details

Defined in Data.Ring

Ring a => Ring (Quaternion a) Source # 
Instance details

Defined in Data.Semifield.Quaternion