Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Signed integer types
This module provides signed integer types of unspecified width (Int
)
and fixed widths (Int8
, Int16
, Int32
and Int64
). 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
. 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 language 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.
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
Bounded Int | Since: base-2.1 |
Enum Int | Since: base-2.1 |
Eq Int | |
Integral Int | Since: base-2.0.1 |
Num Int | Since: base-2.1 |
Ord Int | |
Read Int | Since: base-2.1 |
Real Int | Since: base-2.0.1 |
Defined in GHC.Real toRational :: Int -> Rational # | |
Show Int | Since: base-2.1 |
Ix Int | Since: base-2.1 |
Storable Int | Since: base-2.1 |
Defined in Foreign.Storable | |
Bits Int | Since: base-2.1 |
Defined in Data.Bits | |
FiniteBits Int | Since: base-4.6.0.0 |
Defined in Data.Bits | |
Generic1 (URec Int :: k -> Type) | |
Functor (URec Int :: Type -> Type) | Since: base-4.9.0.0 |
Foldable (URec Int :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => URec Int m -> m # foldMap :: Monoid m => (a -> m) -> URec Int a -> m # foldr :: (a -> b -> b) -> b -> URec Int a -> b # foldr' :: (a -> b -> b) -> b -> URec Int a -> b # foldl :: (b -> a -> b) -> b -> URec Int a -> b # foldl' :: (b -> a -> b) -> b -> URec Int a -> b # foldr1 :: (a -> a -> a) -> URec Int a -> a # foldl1 :: (a -> a -> a) -> URec Int a -> a # elem :: Eq a => a -> URec Int a -> Bool # maximum :: Ord a => URec Int a -> a # minimum :: Ord a => URec Int a -> a # | |
Traversable (URec Int :: Type -> Type) | Since: base-4.9.0.0 |
Eq (URec Int p) | Since: base-4.9.0.0 |
Ord (URec Int p) | Since: base-4.9.0.0 |
Show (URec Int p) | Since: base-4.9.0.0 |
Generic (URec Int p) | |
data URec Int (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 |
type Rep1 (URec Int :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
type Rep (URec Int p) | Since: base-4.9.0.0 |
Defined in GHC.Generics |
8-bit signed integer type
Instances
Bounded Int8 | Since: base-2.1 |
Enum Int8 | Since: base-2.1 |
Eq Int8 | Since: base-2.1 |
Integral Int8 | Since: base-2.1 |
Num Int8 | Since: base-2.1 |
Ord Int8 | Since: base-2.1 |
Read Int8 | Since: base-2.1 |
Real Int8 | Since: base-2.1 |
Defined in GHC.Int toRational :: Int8 -> Rational # | |
Show Int8 | Since: base-2.1 |
Ix Int8 | Since: base-2.1 |
Storable Int8 | Since: base-2.1 |
Defined in Foreign.Storable | |
Bits Int8 | Since: base-2.1 |
Defined in GHC.Int (.&.) :: Int8 -> Int8 -> Int8 # (.|.) :: Int8 -> Int8 -> Int8 # complement :: Int8 -> Int8 # shift :: Int8 -> Int -> Int8 # rotate :: Int8 -> Int -> Int8 # setBit :: Int8 -> Int -> Int8 # clearBit :: Int8 -> Int -> Int8 # complementBit :: Int8 -> Int -> Int8 # testBit :: Int8 -> Int -> Bool # bitSizeMaybe :: Int8 -> Maybe Int # shiftL :: Int8 -> Int -> Int8 # unsafeShiftL :: Int8 -> Int -> Int8 # shiftR :: Int8 -> Int -> Int8 # unsafeShiftR :: Int8 -> Int -> Int8 # rotateL :: Int8 -> Int -> Int8 # | |
FiniteBits Int8 | Since: base-4.6.0.0 |
Defined in GHC.Int |
16-bit signed integer type
Instances
32-bit signed integer type
Instances
64-bit signed integer type