Copyright | (c) The University of Glasgow 2001 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | libraries@haskell.org |
Stability | experimental |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Data.Int
Contents
Description
Signed integer types
Signed integer types
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
DataIntSource# | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int -> c IntSource# gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IntSource# toConstr :: Int -> ConstrSource# dataTypeOf :: Int -> DataTypeSource# 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 -> IntSource# gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int -> r Source# gmapQr :: forall r r'. (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 IntSource# gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int -> m IntSource# gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int -> m IntSource# | |
StorableIntSource# | Since: base-2.1 |
BitsIntSource# | Since: base-2.1 |
Defined in GHC.Bits Methods (.&.) :: Int -> Int -> IntSource# (.|.) :: Int -> Int -> IntSource# xor :: Int -> Int -> IntSource# complement :: Int -> IntSource# shift :: Int -> Int -> IntSource# rotate :: Int -> Int -> IntSource# setBit :: Int -> Int -> IntSource# clearBit :: Int -> Int -> IntSource# complementBit :: Int -> Int -> IntSource# testBit :: Int -> Int -> BoolSource# bitSizeMaybe :: Int -> MaybeIntSource# isSigned :: Int -> BoolSource# shiftL :: Int -> Int -> IntSource# unsafeShiftL :: Int -> Int -> IntSource# shiftR :: Int -> Int -> IntSource# unsafeShiftR :: Int -> Int -> IntSource# rotateL :: Int -> Int -> IntSource# | |
FiniteBitsIntSource# | Since: base-4.6.0.0 |
BoundedIntSource# | Since: base-2.1 |
EnumIntSource# | Since: base-2.1 |
Defined in GHC.Enum | |
IxIntSource# | Since: base-2.1 |
NumIntSource# | Since: base-2.1 |
ReadIntSource# | Since: base-2.1 |
IntegralIntSource# | Since: base-2.0.1 |
RealIntSource# | Since: base-2.0.1 |
ShowIntSource# | Since: base-2.1 |
PrintfArgIntSource# | Since: base-2.1 |
Defined in Text.Printf | |
EqInt | |
OrdInt | |
Generic1 (URecInt :: k -> Type)Source# | |
Foldable (UInt :: TYPELiftedRep -> Type)Source# | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => UInt m -> m Source# foldMap :: Monoid m => (a -> m) -> UInt a -> m Source# foldMap' :: Monoid m => (a -> m) -> UInt a -> m Source# foldr :: (a -> b -> b) -> b -> UInt a -> b Source# foldr' :: (a -> b -> b) -> b -> UInt a -> b Source# foldl :: (b -> a -> b) -> b -> UInt a -> b Source# foldl' :: (b -> a -> b) -> b -> UInt a -> b Source# foldr1 :: (a -> a -> a) -> UInt a -> a Source# foldl1 :: (a -> a -> a) -> UInt a -> a Source# toList :: UInt a -> [a] Source# length :: UInt a -> IntSource# elem :: Eq a => a -> UInt a -> BoolSource# maximum :: Ord a => UInt a -> a Source# minimum :: Ord a => UInt a -> a Source# | |
Traversable (UInt :: Type -> Type)Source# | Since: base-4.9.0.0 |
Functor (URecInt :: TYPELiftedRep -> Type)Source# | Since: base-4.9.0.0 |
Generic (URecInt p)Source# | |
Show (URecInt p)Source# | Since: base-4.9.0.0 |
Eq (URecInt p)Source# | Since: base-4.9.0.0 |
Ord (URecInt p)Source# | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
dataURecInt (p :: k)Source# | Used for marking occurrences of Since: base-4.9.0.0 |
typeRep1 (URecInt :: k -> Type)Source# | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
typeRep (URecInt p)Source# | Since: base-4.9.0.0 |
Defined in GHC.Generics |
8-bit signed integer type
Instances
DataInt8Source# | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int8 -> c Int8Source# gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int8Source# toConstr :: Int8 -> ConstrSource# dataTypeOf :: Int8 -> DataTypeSource# 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 -> Int8Source# gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int8 -> r Source# gmapQr :: forall r r'. (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 Int8Source# gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int8 -> m Int8Source# gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int8 -> m Int8Source# | |
StorableInt8Source# | Since: base-2.1 |
BitsInt8Source# | Since: base-2.1 |
Defined in GHC.Int Methods (.&.) :: Int8 -> Int8 -> Int8Source# (.|.) :: Int8 -> Int8 -> Int8Source# xor :: Int8 -> Int8 -> Int8Source# complement :: Int8 -> Int8Source# shift :: Int8 -> Int -> Int8Source# rotate :: Int8 -> Int -> Int8Source# setBit :: Int8 -> Int -> Int8Source# clearBit :: Int8 -> Int -> Int8Source# complementBit :: Int8 -> Int -> Int8Source# testBit :: Int8 -> Int -> BoolSource# bitSizeMaybe :: Int8 -> MaybeIntSource# isSigned :: Int8 -> BoolSource# shiftL :: Int8 -> Int -> Int8Source# unsafeShiftL :: Int8 -> Int -> Int8Source# shiftR :: Int8 -> Int -> Int8Source# unsafeShiftR :: Int8 -> Int -> Int8Source# rotateL :: Int8 -> Int -> Int8Source# | |
FiniteBitsInt8Source# | Since: base-4.6.0.0 |
BoundedInt8Source# | Since: base-2.1 |
EnumInt8Source# | Since: base-2.1 |
Defined in GHC.Int | |
IxInt8Source# | Since: base-2.1 |
NumInt8Source# | Since: base-2.1 |
ReadInt8Source# | Since: base-2.1 |
IntegralInt8Source# | Since: base-2.1 |
RealInt8Source# | Since: base-2.1 |
ShowInt8Source# | Since: base-2.1 |
PrintfArgInt8Source# | Since: base-2.1 |
Defined in Text.Printf | |
EqInt8Source# | Since: base-2.1 |
OrdInt8Source# | Since: base-2.1 |
16-bit signed integer type
Instances
32-bit signed integer type
Instances
64-bit signed integer type
Instances
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 asInt
(see the section of the Haskell report dealing with arithmetic sequences) also hold for theEnum
instances over the variousInt
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.