 | NumericPrelude-0.0: An experimental alternative hierarchy of numeric type classes | Contents | Index |
|
|
|
|
|
|
| Synopsis |
|
| class C a => C a where | | | | isUnit :: C a => a -> Bool | | | stdAssociate :: C a => a -> a | | | stdUnit :: C a => a -> a | | | stdUnitInv :: C a => a -> a | | | intQuery :: (Integral a, C a) => a -> Bool | | | intAssociate :: (Integral a, C a, C a) => a -> a | | | intStandard :: (Integral a, C a, C a) => a -> a | | | intStandardInverse :: (Integral a, C a, C a) => a -> a | | | propComposition :: (Eq a, C a) => a -> Bool | | | propInverseUnit :: (Eq a, C a) => a -> Bool | | | propUniqueAssociate :: (Eq a, C a) => a -> a -> Property | | | propAssociateProduct :: (Eq a, C a) => a -> a -> Bool |
|
|
|
| Class
|
|
| class C a => C a where |
This class lets us deal with the units in a ring.
isUnit tells whether an element is a unit.
The other operations let us canonically
write an element as a unit times another element.
Two elements a, b of a ring R are _associates_ if a=b*u for a unit u.
For an element a, we want to write it as a=b*u where b is an associate of a.
The map (a->b) is called
StandardAssociate by Gap,
unitCanonical by Axiom,
and canAssoc by DoCon.
The map (a->u) is called
canInv by DoCon and
unitNormal(x).unit by Axiom.
The laws are
stdAssociate x * stdUnit x === x
stdUnit x * stdUnitInv x === 1
isUnit u ==> stdAssociate x === stdAssociate (x*u)
Currently some algorithms assume
stdAssociate(x*y) === stdAssociate x * stdAssociate y
Minimal definition:
isUnit and (stdUnit or stdUnitInv) and optionally stdAssociate
| | | Methods | | isUnit :: a -> Bool | | | stdAssociate :: a -> a | | | stdUnit :: a -> a | | | stdUnitInv :: a -> a |
| | Instances | |
|
|
| isUnit :: C a => a -> Bool |
|
| stdAssociate :: C a => a -> a |
|
| stdUnit :: C a => a -> a |
|
| stdUnitInv :: C a => a -> a |
|
| Standard implementations for instances
|
|
| intQuery :: (Integral a, C a) => a -> Bool |
|
| intAssociate :: (Integral a, C a, C a) => a -> a |
|
| intStandard :: (Integral a, C a, C a) => a -> a |
|
| intStandardInverse :: (Integral a, C a, C a) => a -> a |
|
| Properties
|
|
| propComposition :: (Eq a, C a) => a -> Bool |
|
| propInverseUnit :: (Eq a, C a) => a -> Bool |
|
| propUniqueAssociate :: (Eq a, C a) => a -> a -> Property |
|
| propAssociateProduct :: (Eq a, C a) => a -> a -> Bool |
|
| Produced by Haddock version 0.7 |