numhask-0.0.4: A numeric prelude

Contents

Description

Multiplicate structure Many treatments of a numeric tower treat multiplication differently to addition. NumHask treats these two as exactly symmetrical, and thus departs from the usual mathematical terminology.

Synopsis

## Multiplicative Structure

class MultiplicativeMagma a where Source #

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

Minimal complete definition

times

Methods

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

Instances

 Source # Methodstimes :: Bool -> Bool -> Bool Source # Source # Methods Source # Methods Source # Methodstimes :: Int -> Int -> Int Source # Source # Methods Source # Methodstimes :: Complex a -> Complex a -> Complex a Source #

class MultiplicativeMagma a => MultiplicativeUnital a where Source #

MultiplicativeUnital

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

Minimal complete definition

one

Methods

one :: a Source #

Instances

 Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods

MultiplicativeAssociative

(a times b) times c == a times (b times c)

MultiplicativeCommutative

a times b == b times a

class MultiplicativeMagma a => MultiplicativeInvertible a where Source #

MultiplicativeInvertible

∀ a ∈ A: recip a ∈ A

law is true by construction in Haskell

Minimal complete definition

recip

Methods

recip :: a -> a Source #

Instances

 Source # Methods Source # Methods Source # Methodsrecip :: Complex a -> Complex a Source #

class MultiplicativeMagma b => MultiplicativeHomomorphic a b where Source #

MultiplicativeHomomorphic

∀ a ∈ A: timeshom a ∈ B

law is true by construction in Haskell

Minimal complete definition

timeshom

Methods

timeshom :: a -> b Source #

Instances

 Source # Methodstimeshom :: a -> a Source #

MultiplicativeMonoidal

Multiplicative is commutative, associative and unital under multiplication

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

Methods

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

Instances

 Source # Methods(*) :: Bool -> Bool -> Bool Source # Source # Methods Source # Methods Source # Methods(*) :: Int -> Int -> Int Source # Source # Methods Source # Methods(*) :: Complex a -> Complex a -> Complex a Source #

Non-commutative right divide

Methods

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

Non-commutative left divide

Methods

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

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

MultiplicativeGroup

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

Methods

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

Instances

 Source # Methods Source # Methods Source # Methods(/) :: Complex a -> Complex a -> Complex a Source #