base-4.9.1.0: Basic libraries

Data.Int

Contents

Description

Signed integer types

Synopsis

# Signed integer types

data Int :: * #

A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]. The exact range for a given implementation can be determined by using minBound and maxBound from the Bounded class.

Instances

 Source # Methods Source # MethodsenumFrom :: Int -> [Int] Source #enumFromThen :: Int -> Int -> [Int] Source #enumFromTo :: Int -> Int -> [Int] Source #enumFromThenTo :: Int -> Int -> Int -> [Int] Source # Methods(==) :: Int -> Int -> Bool #(/=) :: Int -> Int -> Bool # Source # Methodsquot :: Int -> Int -> Int Source #rem :: Int -> Int -> Int Source #div :: Int -> Int -> Int Source #mod :: Int -> Int -> Int Source #quotRem :: Int -> Int -> (Int, Int) Source #divMod :: Int -> Int -> (Int, Int) Source # Source # Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int -> c Int Source #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int Source #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Int) Source #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int) Source #gmapT :: (forall b. Data b => b -> b) -> Int -> Int Source #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int -> r Source #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int -> r Source #gmapQ :: (forall d. Data d => d -> u) -> Int -> [u] Source #gmapQi :: Int -> (forall d. Data d => d -> u) -> Int -> u Source #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int -> m Int Source #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int -> m Int Source #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int -> m Int Source # Source # Methods(+) :: Int -> Int -> Int Source #(-) :: Int -> Int -> Int Source #(*) :: Int -> Int -> Int Source #abs :: Int -> Int Source # Methodscompare :: Int -> Int -> Ordering #(<) :: Int -> Int -> Bool #(<=) :: Int -> Int -> Bool #(>) :: Int -> Int -> Bool #(>=) :: Int -> Int -> Bool #max :: Int -> Int -> Int #min :: Int -> Int -> Int # Source # Methods Source # Methods Source # MethodsshowList :: [Int] -> ShowS Source # Source # Methodsrange :: (Int, Int) -> [Int] Source #index :: (Int, Int) -> Int -> Int Source #unsafeIndex :: (Int, Int) -> Int -> IntinRange :: (Int, Int) -> Int -> Bool Source #rangeSize :: (Int, Int) -> Int Source #unsafeRangeSize :: (Int, Int) -> Int Source # Methods Source # Methods(.&.) :: Int -> Int -> Int Source #(.|.) :: Int -> Int -> Int Source #xor :: Int -> Int -> Int Source #shift :: Int -> Int -> Int Source #rotate :: Int -> Int -> Int Source #bit :: Int -> Int Source #setBit :: Int -> Int -> Int Source #clearBit :: Int -> Int -> Int Source #testBit :: Int -> Int -> Bool Source #shiftL :: Int -> Int -> Int Source #shiftR :: Int -> Int -> Int Source #rotateL :: Int -> Int -> Int Source #rotateR :: Int -> Int -> Int Source # Source # MethodspokeElemOff :: Ptr Int -> Int -> Int -> IO () Source #peekByteOff :: Ptr b -> Int -> IO Int Source #pokeByteOff :: Ptr b -> Int -> Int -> IO () Source #poke :: Ptr Int -> Int -> IO () Source # Source # Methods Source # Methodsfmap :: (a -> b) -> URec Int a -> URec Int b Source #(<\$) :: a -> URec Int b -> URec Int a Source # Source # Methodsfold :: Monoid m => URec Int m -> m Source #foldMap :: Monoid m => (a -> m) -> URec Int a -> m Source #foldr :: (a -> b -> b) -> b -> URec Int a -> b Source #foldr' :: (a -> b -> b) -> b -> URec Int a -> b Source #foldl :: (b -> a -> b) -> b -> URec Int a -> b Source #foldl' :: (b -> a -> b) -> b -> URec Int a -> b Source #foldr1 :: (a -> a -> a) -> URec Int a -> a Source #foldl1 :: (a -> a -> a) -> URec Int a -> a Source #toList :: URec Int a -> [a] Source #null :: URec Int a -> Bool Source #length :: URec Int a -> Int Source #elem :: Eq a => a -> URec Int a -> Bool Source #maximum :: Ord a => URec Int a -> a Source #minimum :: Ord a => URec Int a -> a Source #sum :: Num a => URec Int a -> a Source #product :: Num a => URec Int a -> a Source # Source # Methodstraverse :: Applicative f => (a -> f b) -> URec Int a -> f (URec Int b) Source #sequenceA :: Applicative f => URec Int (f a) -> f (URec Int a) Source #mapM :: Monad m => (a -> m b) -> URec Int a -> m (URec Int b) Source #sequence :: Monad m => URec Int (m a) -> m (URec Int a) Source # Source # Associated Typestype Rep1 (URec Int :: * -> *) :: * -> * Source # Methodsfrom1 :: URec Int a -> Rep1 (URec Int) a Source #to1 :: Rep1 (URec Int) a -> URec Int a Source # Eq (URec Int p) # Methods(==) :: URec Int p -> URec Int p -> Bool #(/=) :: URec Int p -> URec Int p -> Bool # Ord (URec Int p) # Methodscompare :: URec Int p -> URec Int p -> Ordering #(<) :: URec Int p -> URec Int p -> Bool #(<=) :: URec Int p -> URec Int p -> Bool #(>) :: URec Int p -> URec Int p -> Bool #(>=) :: URec Int p -> URec Int p -> Bool #max :: URec Int p -> URec Int p -> URec Int p #min :: URec Int p -> URec Int p -> URec Int p # Show (URec Int p) Source # MethodsshowsPrec :: Int -> URec Int p -> ShowS Source #show :: URec Int p -> String Source #showList :: [URec Int p] -> ShowS Source # Source # Associated Typestype Rep (URec Int p) :: * -> * Source # Methodsfrom :: URec Int p -> Rep (URec Int p) x Source #to :: Rep (URec Int p) x -> URec Int p Source # data URec Int Source # Used for marking occurrences of Int# data URec Int = UInt {uInt# :: Int#} type Rep1 (URec Int) Source # type Rep1 (URec Int) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UInt" PrefixI True) (S1 (MetaSel (Just Symbol "uInt#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) UInt)) type Rep (URec Int p) Source # type Rep (URec Int p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UInt" PrefixI True) (S1 (MetaSel (Just Symbol "uInt#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) UInt))

data Int8 Source #

8-bit signed integer type

Instances

 Source # Methods Source # MethodsenumFrom :: Int8 -> [Int8] Source #enumFromThen :: Int8 -> Int8 -> [Int8] Source #enumFromTo :: Int8 -> Int8 -> [Int8] Source #enumFromThenTo :: Int8 -> Int8 -> Int8 -> [Int8] Source # Source # Methods(==) :: Int8 -> Int8 -> Bool #(/=) :: Int8 -> Int8 -> Bool # Source # Methodsquot :: Int8 -> Int8 -> Int8 Source #rem :: Int8 -> Int8 -> Int8 Source #div :: Int8 -> Int8 -> Int8 Source #mod :: Int8 -> Int8 -> Int8 Source #quotRem :: Int8 -> Int8 -> (Int8, Int8) Source #divMod :: Int8 -> Int8 -> (Int8, Int8) Source # Source # Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int8 -> c Int8 Source #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int8 Source #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Int8) Source #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int8) Source #gmapT :: (forall b. Data b => b -> b) -> Int8 -> Int8 Source #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int8 -> r Source #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int8 -> r Source #gmapQ :: (forall d. Data d => d -> u) -> Int8 -> [u] Source #gmapQi :: Int -> (forall d. Data d => d -> u) -> Int8 -> u Source #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int8 -> m Int8 Source #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int8 -> m Int8 Source #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int8 -> m Int8 Source # Source # Methods(+) :: Int8 -> Int8 -> Int8 Source #(-) :: Int8 -> Int8 -> Int8 Source #(*) :: Int8 -> Int8 -> Int8 Source # Source # Methodscompare :: Int8 -> Int8 -> Ordering #(<) :: Int8 -> Int8 -> Bool #(<=) :: Int8 -> Int8 -> Bool #(>) :: Int8 -> Int8 -> Bool #(>=) :: Int8 -> Int8 -> Bool #max :: Int8 -> Int8 -> Int8 #min :: Int8 -> Int8 -> Int8 # Source # Methods Source # Methods Source # MethodsshowList :: [Int8] -> ShowS Source # Source # Methodsrange :: (Int8, Int8) -> [Int8] Source #index :: (Int8, Int8) -> Int8 -> Int Source #unsafeIndex :: (Int8, Int8) -> Int8 -> IntinRange :: (Int8, Int8) -> Int8 -> Bool Source #rangeSize :: (Int8, Int8) -> Int Source #unsafeRangeSize :: (Int8, Int8) -> Int Source # Methods Source # Methods(.&.) :: Int8 -> Int8 -> Int8 Source #(.|.) :: Int8 -> Int8 -> Int8 Source #xor :: Int8 -> Int8 -> Int8 Source #shift :: Int8 -> Int -> Int8 Source #rotate :: Int8 -> Int -> Int8 Source #setBit :: Int8 -> Int -> Int8 Source #shiftL :: Int8 -> Int -> Int8 Source #shiftR :: Int8 -> Int -> Int8 Source # Source # MethodspokeElemOff :: Ptr Int8 -> Int -> Int8 -> IO () Source #peekByteOff :: Ptr b -> Int -> IO Int8 Source #pokeByteOff :: Ptr b -> Int -> Int8 -> IO () Source #poke :: Ptr Int8 -> Int8 -> IO () Source # Source # Methods

data Int16 Source #

16-bit signed integer type

Instances

 Source # Methods Source # MethodsenumFrom :: Int16 -> [Int16] Source #enumFromThen :: Int16 -> Int16 -> [Int16] Source #enumFromTo :: Int16 -> Int16 -> [Int16] Source #enumFromThenTo :: Int16 -> Int16 -> Int16 -> [Int16] Source # Source # Methods(==) :: Int16 -> Int16 -> Bool #(/=) :: Int16 -> Int16 -> Bool # Source # MethodsquotRem :: Int16 -> Int16 -> (Int16, Int16) Source #divMod :: Int16 -> Int16 -> (Int16, Int16) Source # Source # Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int16 -> c Int16 Source #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int16 Source #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Int16) Source #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int16) Source #gmapT :: (forall b. Data b => b -> b) -> Int16 -> Int16 Source #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int16 -> r Source #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int16 -> r Source #gmapQ :: (forall d. Data d => d -> u) -> Int16 -> [u] Source #gmapQi :: Int -> (forall d. Data d => d -> u) -> Int16 -> u Source #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int16 -> m Int16 Source #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int16 -> m Int16 Source #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int16 -> m Int16 Source # Source # Methods Source # Methods(<) :: Int16 -> Int16 -> Bool #(<=) :: Int16 -> Int16 -> Bool #(>) :: Int16 -> Int16 -> Bool #(>=) :: Int16 -> Int16 -> Bool #max :: Int16 -> Int16 -> Int16 #min :: Int16 -> Int16 -> Int16 # Source # Methods Source # Methods Source # MethodsshowList :: [Int16] -> ShowS Source # Source # Methodsrange :: (Int16, Int16) -> [Int16] Source #index :: (Int16, Int16) -> Int16 -> Int Source #unsafeIndex :: (Int16, Int16) -> Int16 -> IntinRange :: (Int16, Int16) -> Int16 -> Bool Source #rangeSize :: (Int16, Int16) -> Int Source #unsafeRangeSize :: (Int16, Int16) -> Int Source # Methods Source # Methods Source # MethodspokeElemOff :: Ptr Int16 -> Int -> Int16 -> IO () Source #peekByteOff :: Ptr b -> Int -> IO Int16 Source #pokeByteOff :: Ptr b -> Int -> Int16 -> IO () Source #poke :: Ptr Int16 -> Int16 -> IO () Source # Source # Methods

data Int32 Source #

32-bit signed integer type

Instances

 Source # Methods Source # MethodsenumFrom :: Int32 -> [Int32] Source #enumFromThen :: Int32 -> Int32 -> [Int32] Source #enumFromTo :: Int32 -> Int32 -> [Int32] Source #enumFromThenTo :: Int32 -> Int32 -> Int32 -> [Int32] Source # Source # Methods(==) :: Int32 -> Int32 -> Bool #(/=) :: Int32 -> Int32 -> Bool # Source # MethodsquotRem :: Int32 -> Int32 -> (Int32, Int32) Source #divMod :: Int32 -> Int32 -> (Int32, Int32) Source # Source # Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int32 -> c Int32 Source #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int32 Source #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Int32) Source #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int32) Source #gmapT :: (forall b. Data b => b -> b) -> Int32 -> Int32 Source #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int32 -> r Source #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int32 -> r Source #gmapQ :: (forall d. Data d => d -> u) -> Int32 -> [u] Source #gmapQi :: Int -> (forall d. Data d => d -> u) -> Int32 -> u Source #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int32 -> m Int32 Source #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int32 -> m Int32 Source #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int32 -> m Int32 Source # Source # Methods Source # Methods(<) :: Int32 -> Int32 -> Bool #(<=) :: Int32 -> Int32 -> Bool #(>) :: Int32 -> Int32 -> Bool #(>=) :: Int32 -> Int32 -> Bool #max :: Int32 -> Int32 -> Int32 #min :: Int32 -> Int32 -> Int32 # Source # Methods Source # Methods Source # MethodsshowList :: [Int32] -> ShowS Source # Source # Methodsrange :: (Int32, Int32) -> [Int32] Source #index :: (Int32, Int32) -> Int32 -> Int Source #unsafeIndex :: (Int32, Int32) -> Int32 -> IntinRange :: (Int32, Int32) -> Int32 -> Bool Source #rangeSize :: (Int32, Int32) -> Int Source #unsafeRangeSize :: (Int32, Int32) -> Int Source # Methods Source # Methods Source # MethodspokeElemOff :: Ptr Int32 -> Int -> Int32 -> IO () Source #peekByteOff :: Ptr b -> Int -> IO Int32 Source #pokeByteOff :: Ptr b -> Int -> Int32 -> IO () Source #poke :: Ptr Int32 -> Int32 -> IO () Source # Source # Methods

data Int64 Source #

64-bit signed integer type

Instances

 Source # Methods Source # MethodsenumFrom :: Int64 -> [Int64] Source #enumFromThen :: Int64 -> Int64 -> [Int64] Source #enumFromTo :: Int64 -> Int64 -> [Int64] Source #enumFromThenTo :: Int64 -> Int64 -> Int64 -> [Int64] Source # Source # Methods(==) :: Int64 -> Int64 -> Bool #(/=) :: Int64 -> Int64 -> Bool # Source # MethodsquotRem :: Int64 -> Int64 -> (Int64, Int64) Source #divMod :: Int64 -> Int64 -> (Int64, Int64) Source # Source # Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int64 -> c Int64 Source #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int64 Source #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Int64) Source #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int64) Source #gmapT :: (forall b. Data b => b -> b) -> Int64 -> Int64 Source #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int64 -> r Source #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int64 -> r Source #gmapQ :: (forall d. Data d => d -> u) -> Int64 -> [u] Source #gmapQi :: Int -> (forall d. Data d => d -> u) -> Int64 -> u Source #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int64 -> m Int64 Source #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int64 -> m Int64 Source #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int64 -> m Int64 Source # Source # Methods Source # Methods(<) :: Int64 -> Int64 -> Bool #(<=) :: Int64 -> Int64 -> Bool #(>) :: Int64 -> Int64 -> Bool #(>=) :: Int64 -> Int64 -> Bool #max :: Int64 -> Int64 -> Int64 #min :: Int64 -> Int64 -> Int64 # Source # Methods Source # Methods Source # MethodsshowList :: [Int64] -> ShowS Source # Source # Methodsrange :: (Int64, Int64) -> [Int64] Source #index :: (Int64, Int64) -> Int64 -> Int Source #unsafeIndex :: (Int64, Int64) -> Int64 -> IntinRange :: (Int64, Int64) -> Int64 -> Bool Source #rangeSize :: (Int64, Int64) -> Int Source #unsafeRangeSize :: (Int64, Int64) -> Int Source # Methods Source # Methods Source # MethodspokeElemOff :: Ptr Int64 -> Int -> Int64 -> IO () Source #peekByteOff :: Ptr b -> Int -> IO Int64 Source #pokeByteOff :: Ptr b -> Int -> Int64 -> IO () Source #poke :: Ptr Int64 -> Int64 -> IO () Source # Source # Methods

# Notes

• All arithmetic is performed modulo 2^n, where n is the number of bits in the type.
• For coercing between any two integer types, use fromIntegral, which is specialized for all the common cases so should be fast enough. Coercing word types (see Data.Word) to and from integer types preserves representation, not sign.
• The rules that hold for Enum instances over a bounded type such as Int (see the section of the Haskell report dealing with arithmetic sequences) also hold for the Enum instances over the various Int types defined here.
• Right and left shifts by amounts greater than or equal to the width of the type result in either zero or -1, depending on the sign of the value being shifted. This is contrary to the behaviour in C, which is undefined; a common interpretation is to truncate the shift count to the width of the type, for example 1 << 32 == 1 in some C implementations.