| Safe Haskell | Safe | 
|---|---|
| Language | Haskell2010 | 
Num.Integral
Synopsis
- class (Real a, Enum a) => Integral a where
 - even :: Integral a => a -> Bool
 - odd :: Integral a => a -> Bool
 - gcd :: Integral a => a -> a -> a
 - lcm :: Integral a => a -> a -> a
 - fromIntegral :: (Integral a, Num b) => a -> b
 - showInt :: Integral a => a -> ShowS
 - showIntAtBase :: (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS
 - showOct :: (Integral a, Show a) => a -> ShowS
 - showHex :: (Integral a, Show a) => a -> ShowS
 
Integral
class (Real a, Enum a) => Integral a where #
Integral numbers, supporting integer division.
Methods
quot :: a -> a -> a infixl 7 #
integer division truncated toward zero
integer remainder, satisfying
(x `quot` y)*y + (x `rem` y) == x
integer division truncated toward negative infinity
integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == x
conversion to Integer
Instances
gcd :: Integral a => a -> a -> a #
 is the non-negative factor of both gcd x yx and y of which
 every common factor of x and y is also a factor; for example
 , gcd 4 2 = 2, gcd (-4) 6 = 2 = gcd 0 44.  = gcd 0 00.
 (That is, the common divisor that is "greatest" in the divisibility
 preordering.)
Note: Since for signed fixed-width integer types, ,
 the result may be negative if one of the arguments is abs minBound < 0 (and
 necessarily is if the other is minBound0 or ) for such types.minBound
lcm :: Integral a => a -> a -> a #
 is the smallest positive integer that both lcm x yx and y divide.
fromIntegral :: (Integral a, Num b) => a -> b #
general coercion from integral types