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



Generally before using quot and rem, think twice. In most cases divMod and friends are the right choice, because they fulfill more of the wanted properties. On some systems quot and rem are more efficient and if you only use positive numbers, you may be happy with them. But we cannot warrant the efficiency advantage.

See also: Daan Leijen: Division and Modulus for Computer Scientists,



class (C a, Ord a, C a) => C a whereSource

Remember that divMod does not specify exactly what a quot b should be, mainly because there is no sensible way to define it in general. For an instance of Algebra.RealIntegral.C a, it is expected that a quot b will round towards 0 and a Prelude.div b will round towards minus infinity.

Minimal definition: nothing required


quot :: a -> a -> aSource

rem :: a -> a -> aSource

quotRem :: a -> a -> (a, a)Source


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 a => C (T a) 
(C a, C a) => C (T a)