- quot, rem, div, mod :: a -> a -> a
- quotRem, divMod :: a -> a -> (a,a)
- toInteger :: a -> Integer
-
- n `quot` d = q where (q,_) = quotRem n d
- n `rem` d = r where (_,r) = quotRem n d
- n `div` d = q where (q,_) = divMod n d
- n `mod` d = r where (_,r) = divMod n d
- divMod n d = if signum r == negate (signum d) then (q-1, r+d) else qr
- where qr@(q,r) = quotRem n d
-
+ -- | integer division truncated toward zero
+ quot :: a -> a -> a
+ -- | integer remainder, satisfying
+ --
+ -- > (x `quot` y)*y + (x `rem` y) == x
+ rem :: a -> a -> a
+ -- | integer division truncated toward negative infinity
+ div :: a -> a -> a
+ -- | integer modulus, satisfying
+ --
+ -- > (x `div` y)*y + (x `mod` y) == x
+ mod :: a -> a -> a
+ -- | simultaneous 'quot' and 'rem'
+ quotRem :: a -> a -> (a,a)
+ -- | simultaneous 'div' and 'mod'
+ divMod :: a -> a -> (a,a)
+ -- | conversion to 'Integer'
+ toInteger :: a -> Integer
+
+ {-# INLINE quot #-}
+ {-# INLINE rem #-}
+ {-# INLINE div #-}
+ {-# INLINE mod #-}
+ n `quot` d = q where (q,_) = quotRem n d
+ n `rem` d = r where (_,r) = quotRem n d
+ n `div` d = q where (q,_) = divMod n d
+ n `mod` d = r where (_,r) = divMod n d
+
+ divMod n d = if signum r == negate (signum d) then (q-1, r+d) else qr
+ where qr@(q,r) = quotRem n d
+
+-- | Fractional numbers, supporting real division.
+--
+-- Minimal complete definition: 'fromRational' and ('recip' or @('/')@)