plankton-0.0.0.1: The core of a numeric prelude, taken from numhask

Safe HaskellSafe
LanguageHaskell2010

Plankton.Multiplicative

Description

A magma heirarchy for multiplication. The basic magma structure is repeated and prefixed with 'Multiplicative-'.

Synopsis

Documentation

class MultiplicativeMagma a where Source #

times is used as the operator for the multiplicative magam to distinguish from * which, by convention, implies commutativity

∀ a,b ∈ A: a `times` b ∈ A

law is true by construction in Haskell

Minimal complete definition

times

Methods

times :: a -> a -> a Source #

class MultiplicativeMagma a => MultiplicativeUnital a where Source #

Unital magma for multiplication.

one `times` a == a
a `times` one == a

Minimal complete definition

one

Methods

one :: a Source #

class MultiplicativeMagma a => MultiplicativeInvertible a where Source #

Invertible magma for multiplication.

∀ a ∈ A: recip a ∈ A

law is true by construction in Haskell

Minimal complete definition

recip

Methods

recip :: a -> a Source #

product :: (Multiplicative a, Foldable f) => f a -> a Source #

product definition avoiding a clash with the Product monoid in base

class (MultiplicativeCommutative a, MultiplicativeUnital a, MultiplicativeAssociative a) => Multiplicative a where Source #

Multiplicative is commutative, associative and unital under multiplication

one * a == a
a * one == a
(a * b) * c == a * (b * c)
a * b == b * a

Methods

(*) :: a -> a -> a infixl 7 Source #

class (MultiplicativeUnital a, MultiplicativeAssociative a, MultiplicativeInvertible a) => MultiplicativeRightCancellative a where Source #

Non-commutative right divide

a `times` recip a = one

Methods

(/~) :: a -> a -> a infixl 7 Source #

class (MultiplicativeUnital a, MultiplicativeAssociative a, MultiplicativeInvertible a) => MultiplicativeLeftCancellative a where Source #

Non-commutative left divide

recip a `times` a = one

Methods

(~/) :: a -> a -> a infixl 7 Source #

class (Multiplicative a, MultiplicativeInvertible a) => MultiplicativeGroup a where Source #

Divide (/) is reserved for where both the left and right cancellative laws hold. This then implies that the MultiplicativeGroup is also Abelian.

a / a = one
recip a = one / a
recip a * a = one
a * recip a = one

Methods

(/) :: a -> a -> a infixl 7 Source #