Copyright | (c) 2020 Emily Pillmore |
---|---|

License | BSD-style |

Maintainer | Emily Pillmore <emilypi@cohomolo.gy>, Reed Mullanix <reedmullanix@gmail.com> |

Stability | stable |

Portability | non-portable |

Safe Haskell | Safe |

Language | Haskell2010 |

This module contains definitions for `AdditiveGroup`

and `AdditiveAbelianGroup`

,
along with the relevant combinators.

## Synopsis

- class Group g => AdditiveGroup g
- (-) :: AdditiveGroup a => a -> a -> a
- (+) :: AdditiveGroup g => g -> g -> g
- (×) :: (Integral n, AdditiveGroup a) => n -> a -> a
- copower :: (Integral n, AdditiveGroup g) => n -> g -> g
- class (AbelianGroup g, AdditiveGroup g) => AdditiveAbelianGroup g

# Additive groups

class Group g => AdditiveGroup g Source #

An additive group is a `Group`

whose operation can be thought of
as addition in some sense.

For example, the additive group of integers \( (ℤ, 0, +) \).

#### Instances

## Combinators

(-) :: AdditiveGroup a => a -> a -> a infixl 6 Source #

Infix alias for `minus`

.

**Examples**:

`>>>`

`let x = Sum (3 :: Int)`

`>>>`

Sum {getSum = 0}`x - x`

`>>>`

`let x = Any True`

`>>>`

Any {getAny = True}`x - x`

(+) :: AdditiveGroup g => g -> g -> g infixl 6 Source #

(×) :: (Integral n, AdditiveGroup a) => n -> a -> a infixl 7 Source #

copower :: (Integral n, AdditiveGroup g) => n -> g -> g Source #

Add an element of an additive group to itself `n`

-many times.

This represents `ℕ`

-indexed copowers of an element `g`

of
an additive group, i.e. iterated coproducts of group elements.
This is representable by the universal property
\( C(∐_n g, x) ≅ C(g, x)^n \).

**Examples**:

`>>>`

Sum {getSum = 6}`copower 2 (Sum (3 :: Int))`

# Additive abelian groups

class (AbelianGroup g, AdditiveGroup g) => AdditiveAbelianGroup g Source #

An additive abelian group is an `AbelianGroup`

whose operation can be thought of
as commutative addition in some sense. Almost all additive groups are abelian.