Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

Field classes

- class (MultiplicativeInvertible a, Ring a) => Semifield a
- class (AdditiveGroup a, MultiplicativeGroup a, Ring a) => Field a
- class Field a => ExpField a where
- class Field a => QuotientField a where
- class Field a => BoundedField a where
- infinity :: BoundedField a => a
- neginfinity :: BoundedField a => a
- class (Ord a, Field a) => TrigField a where

# Documentation

class (MultiplicativeInvertible a, Ring a) => Semifield a Source #

A Semifield is a Field without Commutative Multiplication.

class (AdditiveGroup a, MultiplicativeGroup a, Ring a) => Field a Source #

A Field is a Ring plus additive invertible and multiplicative invertible operations.

A summary of the rules inherited from super-classes of Field

zero + a == a a + zero == a (a + b) + c == a + (b + c) a + b == b + a a - a = zero negate a = zero - a negate a + a = zero a + negate a = zero one * a == a a * one == a (a * b) * c == a * (b * c) a * (b + c) == a * b + a * c (a + b) * c == a * c + b * c a * zero == zero zero * a == zero a * b == b * a a / a = one recip a = one / a recip a * a = one a * recip a = one

class Field a => ExpField a where Source #

A hyperbolic field class

sqrt . (**2) == identity log . exp == identity for +ive b, a != 0,1: a ** logBase a b ≈ b

class Field a => QuotientField a where Source #

quotient fields explode constraints if they allow for polymorphic integral types

a - one < floor a <= a <= ceiling a < a + one round a == floor (a + one/(one+one))

class Field a => BoundedField a where Source #

A bounded field includes the concepts of infinity and NaN, thus moving away from error throwing.

one / zero + infinity == infinity infinity + a == infinity isNaN (infinity - infinity) isNaN (infinity / infinity) isNaN (nan + a) zero / zero != nan

Note the tricky law that, although nan is assigned to zero/zero, they are never-the-less not equal. A committee decided this.

BoundedField Double Source # | |

BoundedField Float Source # | |

BoundedField a => BoundedField (Complex a) Source # | todo: work out boundings for complex as it stands now, complex is different eg one / (zero :: Complex Float) == nan |

infinity :: BoundedField a => a Source #

prints as `Infinity`

neginfinity :: BoundedField a => a Source #

prints as `-Infinity`