NumericPrelude-0.0: An experimental alternative hierarchy of numeric type classesContentsIndex
Algebra.Additive
Contents
Class
Complex functions
Instances for atomic types
Synopsis
class C a where
zero :: a
(+) :: a -> a -> a
(-) :: a -> a -> a
negate :: a -> a
zero :: C a => a
(+) :: C a => a -> a -> a
(-) :: C a => a -> a -> a
negate :: C a => a -> a
subtract :: C a => a -> a -> a
sum :: C a => [a] -> a
sum1 :: C a => [a] -> a
propAssociative :: (Eq a, C a) => a -> a -> a -> Bool
propCommutative :: (Eq a, C a) => a -> a -> Bool
propIdentity :: (Eq a, C a) => a -> Bool
propInverse :: (Eq a, C a) => a -> Bool
Class
class C a where

Additive a encapsulates the notion of a commutative group, specified by the following laws:

          a + b === b + a
    (a + b) + c === a + (b + c)
       zero + a === a
   a + negate a === 0

Typical examples include integers, dollars, and vectors.

Minimal definition: +, zero, and (negate or '(-)')

Methods
zero :: a
zero element of the vector space
(+) :: a -> a -> a
add and subtract elements
(-) :: a -> a -> a
negate :: a -> a
inverse with respect to +
show/hide Instances
C Double
C Float
C Int
C Integer
C T
C T
(C v0, C v1) => C (v0, v1)
(C v0, C v1, C v2) => C (v0, v1, v2)
C v => C (b -> v)
Integral a => C (Ratio a)
C a => C (T a)
C a => C (T a)
(C a, C a, C a) => C (T a)
C a => C (T a)
C a => C (T a)
C a => C (T a)
C a => C (T a)
C a => C (T a)
(C a, C a) => C (T a)
C a => C (T a)
C a => C (T a)
C a => C (T a)
(Eq a, C a) => C (T a)
C a => C (T a)
(Eq a, C a) => C (T a)
C v => C [v]
(Ord i, Eq v, C v) => C (Map i v)
(Ord a, C b) => C (T a b)
C v => C (T a v)
C v => C (T a v)
(Ord i, C a) => C (T i a)
zero :: C a => a
zero element of the vector space
(+) :: C a => a -> a -> a
add and subtract elements
(-) :: C a => a -> a -> a
negate :: C a => a -> a
inverse with respect to +
subtract :: C a => a -> a -> a
subtract is (-) with swapped operand order. This is the operand order which will be needed in most cases of partial application.
Complex functions
sum :: C a => [a] -> a
Sum up all elements of a list. An empty list yields zero.
sum1 :: C a => [a] -> a
Sum up all elements of a non-empty list. This avoids including a zero which is useful for types where no universal zero is available.
Instances for atomic types
propAssociative :: (Eq a, C a) => a -> a -> a -> Bool
propCommutative :: (Eq a, C a) => a -> a -> Bool
propIdentity :: (Eq a, C a) => a -> Bool
propInverse :: (Eq a, C a) => a -> Bool
Produced by Haddock version 0.7