Safe HaskellSafe

Eta.Classes.Integral

Description

The Integral type class defines Integral values and how are they able to be divided

Synopsis

Documentation

dividedBy :: Integral a => a -> a -> a #

Integer division, rounded down

>>> 4 `dividedBy` 2
2
>>> 5 `dividedBy` 2
2

modulus :: Integral a => a -> a -> a #

Integer modulus

>>> 4 `modulus` 2
0
>>> 5 `modulus` 2
1

divideWithRemainder :: Integral a => a -> a -> (a, a) #

Returns result of the division and its remainder

>>> 7 `divideWithRemainder` 2
(3,1)

isEven :: Integral a => a -> Bool #

>>> isEven 2
True

isOdd :: Integral a => a -> Bool #

>>> isOdd 2
False

class (Real a, Enum a) => Integral a where #

Minimal complete definition

quotRem, toInteger

Methods

quot :: a -> a -> a #

rem :: a -> a -> a #

div :: a -> a -> a #

mod :: a -> a -> a #

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

divMod :: a -> a -> (a, a) #

toInteger :: a -> Integer #

Instances

Integral Int 

Methods

quot :: Int -> Int -> Int #

rem :: Int -> Int -> Int #

div :: Int -> Int -> Int #

mod :: Int -> Int -> Int #

quotRem :: Int -> Int -> (Int, Int) #

divMod :: Int -> Int -> (Int, Int) #

toInteger :: Int -> Integer #

Integral Int8 

Methods

quot :: Int8 -> Int8 -> Int8 #

rem :: Int8 -> Int8 -> Int8 #

div :: Int8 -> Int8 -> Int8 #

mod :: Int8 -> Int8 -> Int8 #

quotRem :: Int8 -> Int8 -> (Int8, Int8) #

divMod :: Int8 -> Int8 -> (Int8, Int8) #

toInteger :: Int8 -> Integer #

Integral Int16 

Methods

quot :: Int16 -> Int16 -> Int16 #

rem :: Int16 -> Int16 -> Int16 #

div :: Int16 -> Int16 -> Int16 #

mod :: Int16 -> Int16 -> Int16 #

quotRem :: Int16 -> Int16 -> (Int16, Int16) #

divMod :: Int16 -> Int16 -> (Int16, Int16) #

toInteger :: Int16 -> Integer #

Integral Int32 

Methods

quot :: Int32 -> Int32 -> Int32 #

rem :: Int32 -> Int32 -> Int32 #

div :: Int32 -> Int32 -> Int32 #

mod :: Int32 -> Int32 -> Int32 #

quotRem :: Int32 -> Int32 -> (Int32, Int32) #

divMod :: Int32 -> Int32 -> (Int32, Int32) #

toInteger :: Int32 -> Integer #

Integral Int64 

Methods

quot :: Int64 -> Int64 -> Int64 #

rem :: Int64 -> Int64 -> Int64 #

div :: Int64 -> Int64 -> Int64 #

mod :: Int64 -> Int64 -> Int64 #

quotRem :: Int64 -> Int64 -> (Int64, Int64) #

divMod :: Int64 -> Int64 -> (Int64, Int64) #

toInteger :: Int64 -> Integer #

Integral Integer 

Methods

quot :: Integer -> Integer -> Integer #

rem :: Integer -> Integer -> Integer #

div :: Integer -> Integer -> Integer #

mod :: Integer -> Integer -> Integer #

quotRem :: Integer -> Integer -> (Integer, Integer) #

divMod :: Integer -> Integer -> (Integer, Integer) #

toInteger :: Integer -> Integer #

Integral Word 

Methods

quot :: Word -> Word -> Word #

rem :: Word -> Word -> Word #

div :: Word -> Word -> Word #

mod :: Word -> Word -> Word #

quotRem :: Word -> Word -> (Word, Word) #

divMod :: Word -> Word -> (Word, Word) #

toInteger :: Word -> Integer #

quot :: Integral a => a -> a -> a #

rem :: Integral a => a -> a -> a #

div :: Integral a => a -> a -> a #

mod :: Integral a => a -> a -> a #

quotRem :: Integral a => a -> a -> (a, a) #

divMod :: Integral a => a -> a -> (a, a) #

toInteger :: Integral a => a -> Integer #

(^) :: (Num a, Integral b) => a -> b -> a #

(^^) :: (Fractional a, Integral b) => a -> b -> a #