# Data.CommutativeRing

- Package
- purescript-prelude
- Repository
- purescript/purescript-prelude

### #CommutativeRing Source

`class (Ring a) <= CommutativeRing a `

The `CommutativeRing`

class is for rings where multiplication is
commutative.

Instances must satisfy the following law in addition to the `Ring`

laws:

- Commutative multiplication:
`a * b = b * a`

#### Instances

`CommutativeRing Int`

`CommutativeRing Number`

`CommutativeRing Unit`

`(CommutativeRing b) => CommutativeRing (a -> b)`

`(RowToList row list, CommutativeRingRecord list row row) => CommutativeRing (Record row)`

`CommutativeRing (Proxy a)`

### #CommutativeRingRecord Source

`class CommutativeRingRecord :: RowList Type -> Row Type -> Row Type -> Constraint`

`class (RingRecord rowlist row subrow) <= CommutativeRingRecord rowlist row subrow | rowlist -> subrow`

A class for records where all fields have `CommutativeRing`

instances, used
to implement the `CommutativeRing`

instance for records.

#### Instances

`CommutativeRingRecord Nil row ()`

`(IsSymbol key, Cons key focus subrowTail subrow, CommutativeRingRecord rowlistTail row subrowTail, CommutativeRing focus) => CommutativeRingRecord (Cons key focus rowlistTail) row subrow`

## Re-exports from **Data.**Ring

### #Ring Source

### #RingRecord Source

`class RingRecord :: RowList Type -> Row Type -> Row Type -> Constraint`

`class (SemiringRecord rowlist row subrow) <= RingRecord rowlist row subrow | rowlist -> subrow`

A class for records where all fields have `Ring`

instances, used to
implement the `Ring`

instance for records.

#### Instances

`RingRecord Nil row ()`

`(IsSymbol key, Cons key focus subrowTail subrow, RingRecord rowlistTail row subrowTail, Ring focus) => RingRecord (Cons key focus rowlistTail) row subrow`

## Re-exports from **Data.**Semiring

### #Semiring Source

`class Semiring a where`

The `Semiring`

class is for types that support an addition and
multiplication operation.

Instances must satisfy the following laws:

- Commutative monoid under addition:
- Associativity:
`(a + b) + c = a + (b + c)`

- Identity:
`zero + a = a + zero = a`

- Commutative:
`a + b = b + a`

- Associativity:
- Monoid under multiplication:
- Associativity:
`(a * b) * c = a * (b * c)`

- Identity:
`one * a = a * one = a`

- Associativity:
- Multiplication distributes over addition:
- Left distributivity:
`a * (b + c) = (a * b) + (a * c)`

- Right distributivity:
`(a + b) * c = (a * c) + (b * c)`

- Left distributivity:
- Annihilation:
`zero * a = a * zero = zero`

**Note:** The `Number`

and `Int`

types are not fully law abiding
members of this class hierarchy due to the potential for arithmetic
overflows, and in the case of `Number`

, the presence of `NaN`

and
`Infinity`

values. The behaviour is unspecified in these cases.

#### Members

#### Instances

- Modules
- Control.
Applicative - Control.
Apply - Control.
Bind - Control.
Category - Control.
Monad - Control.
Semigroupoid - Data.
Boolean - Data.
BooleanAlgebra - Data.
Bounded - Data.
Bounded. Generic - Data.
CommutativeRing - Data.
DivisionRing - Data.
Eq - Data.
Eq. Generic - Data.
EuclideanRing - Data.
Field - Data.
Function - Data.
Functor - Data.
Generic. Rep - Data.
HeytingAlgebra - Data.
HeytingAlgebra. Generic - Data.
Monoid - Data.
Monoid. Additive - Data.
Monoid. Conj - Data.
Monoid. Disj - Data.
Monoid. Dual - Data.
Monoid. Endo - Data.
Monoid. Generic - Data.
Monoid. Multiplicative - Data.
NaturalTransformation - Data.
Ord - Data.
Ord. Generic - Data.
Ordering - Data.
Reflectable - Data.
Ring - Data.
Ring. Generic - Data.
Semigroup - Data.
Semigroup. First - Data.
Semigroup. Generic - Data.
Semigroup. Last - Data.
Semiring - Data.
Semiring. Generic - Data.
Show - Data.
Show. Generic - Data.
Symbol - Data.
Unit - Data.
Void - Prelude
- Record.
Unsafe - Type.
Proxy