| Portability | portable | 
|---|---|
| Stability | provisional | 
| Maintainer | ross@soi.city.ac.uk | 
Data.YAP.Algebra
Contents
Description
Classes corresponding to common structures from abstract algebra.
- class AbelianGroup a where
- class AbelianGroup a => Ring a  where- (*) :: a -> a -> a
- fromInteger :: Integer -> a
 
- class (Eq a, Ring a) => EuclideanDomain a where
- class Ring a => Field a where
- subtract :: AbelianGroup a => a -> a -> a
- gcd :: EuclideanDomain a => a -> a -> a
- lcm :: EuclideanDomain a => a -> a -> a
Classes
class AbelianGroup a whereSource
An Abelian group has an commutative associative binary operation with an identity and inverses.
Methods
The identity of (.
+)
A commutative associative operation with identity zero.
Inverse for ( (unary negation).
+)
Instances
| AbelianGroup Double | |
| AbelianGroup Float | |
| AbelianGroup Int | |
| AbelianGroup Integer | |
| EuclideanDomain a => AbelianGroup (Ratio a) | |
| AbelianGroup a => AbelianGroup (Complex a) | |
| AbelianGroup a => AbelianGroup (Vector a) | |
| AbelianGroup a => AbelianGroup (Matrix a) | |
| AbelianGroup a => AbelianGroup (Polynomial a) | |
| (AbelianGroup a, AbelianGroup b) => AbelianGroup (a, b) | Direct product | 
| AbelianGroup a => AbelianGroup (Quantity u a) | 
class AbelianGroup a => Ring a whereSource
A ring: addition forms an Abelian group, and multiplication defines a monoid and distributes over addition. Multiplication is not guaranteed to be commutative.
Minimal complete definition: ( and *)fromInteger.
Methods
An associative operation with identity fromInteger 1( and +)zero.
fromInteger :: Integer -> aSource
Conversion from Integer, the initial ring:
 fromInteger is the unique function preserving zero, (,
 +)( and -)(, and for which *)fromInteger 1(.
*)
An integer literal represents the application of the function
 fromInteger to the appropriate value of type Integer,
 so such literals have type (.
Ring a) => a
class (Eq a, Ring a) => EuclideanDomain a whereSource
A integral domain (a non-trivial commutative Ring with no zero
 divisors) on which the Euclid's algorithm for gcd works.
Minimal complete definition:
  (divMod or (div and mod)) and unit.
Methods
Division with remainder: for any d /= 0,
- n == - divn d * d +- modn d
- mod(n + a*d) d ==- modn d
-  modn ddin some well-founded order.
For integral types, mod n dd.
Instances
| EuclideanDomain Int | |
| EuclideanDomain Integer | |
| Integral a => EuclideanDomain (Complex a) | Gaussian integers:
 if  | 
| (Eq a, Field a) => EuclideanDomain (Polynomial a) | If  | 
class Ring a => Field a whereSource
A commutative Ring in which all non-zero elements have multiplicative
 inverses.
Utility functions
subtract :: AbelianGroup a => a -> a -> aSource
gcd :: EuclideanDomain a => a -> a -> aSource