numeric-prelude-0.4.2: An experimental alternative hierarchy of numeric type classes

Safe HaskellSafe-Inferred
LanguageHaskell98

Algebra.ZeroTestable

Contents

Synopsis

Documentation

class C a where Source

Maybe the naming should be according to Algebra.Unit: Algebra.Zero as module name, and query as method name.

Methods

isZero :: a -> Bool Source

Instances

C Double 
C Float 
C Int 
C Int8 
C Int16 
C Int32 
C Int64 
C Integer 
C Word 
C Word8 
C Word16 
C Word32 
C Word64 
C T 
C T 
C T 
C v => C [v] 
C a => C (T a) 
(C a, C a) => C (T a) 
C a => C (T a) 
(Eq a, Num 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 v0, C v1) => C (v0, v1) 
C v => C (T a v) 
C v => C (T a v) 
C v => C (T a v) 
(C v0, C v1, C v2) => C (v0, v1, v2) 

defltIsZero :: (Eq a, C a) => a -> Bool Source

Checks if a number is the zero element. This test is not possible for all C types, since e.g. a function type does not belong to Eq. isZero is possible for some types where (==zero) fails because there is no unique zero. Examples are vector (the length of the zero vector is unknown), physical values (the unit of a zero quantity is unknown), residue class (the modulus is unknown).

Instances for atomic types

Instances for composed types