# Data.DivisionRing

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

### #DivisionRing Source

`class (Ring a) <= DivisionRing a where`

The `DivisionRing`

class is for non-zero rings in which every non-zero
element has a multiplicative inverse. Division rings are sometimes also
called *skew fields*.

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

laws:

- Non-zero ring:
`one /= zero`

- Non-zero multiplicative inverse:
`recip a * a = a * recip a = one`

for all non-zero`a`

The result of `recip zero`

is left undefined; individual instances may
choose how to handle this case.

If a type has both `DivisionRing`

and `CommutativeRing`

instances, then
it is a field and should have a `Field`

instance.

#### Members

`recip :: a -> a`

#### Instances

### #leftDiv Source

`leftDiv :: forall a. DivisionRing a => a -> a -> a`

Left division, defined as `leftDiv a b = recip b * a`

. Left and right
division are distinct in this module because a `DivisionRing`

is not
necessarily commutative.

If the type `a`

is also a `EuclideanRing`

, then this function is
equivalent to `div`

from the `EuclideanRing`

class. When working
abstractly, `div`

should generally be preferred, unless you know that you
need your code to work with noncommutative rings.

### #rightDiv Source

`rightDiv :: forall a. DivisionRing a => a -> a -> a`

Right division, defined as `rightDiv a b = a * recip b`

. Left and right
division are distinct in this module because a `DivisionRing`

is not
necessarily commutative.

If the type `a`

is also a `EuclideanRing`

, then this function is
equivalent to `div`

from the `EuclideanRing`

class. When working
abstractly, `div`

should generally be preferred, unless you know that you
need your code to work with noncommutative rings.

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

### #Ring Source

## 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.
CommutativeRing - Data.
DivisionRing - Data.
Eq - Data.
EuclideanRing - Data.
Field - Data.
Function - Data.
Functor - Data.
HeytingAlgebra - Data.
Monoid - Data.
Monoid. Additive - Data.
Monoid. Conj - Data.
Monoid. Disj - Data.
Monoid. Dual - Data.
Monoid. Endo - Data.
Monoid. Multiplicative - Data.
NaturalTransformation - Data.
Ord - Data.
Ord. Unsafe - Data.
Ordering - Data.
Ring - Data.
Semigroup - Data.
Semigroup. First - Data.
Semigroup. Last - Data.
Semiring - Data.
Show - Data.
Symbol - Data.
Unit - Data.
Void - Prelude
- Record.
Unsafe - Type.
Data. Row - Type.
Data. RowList