| 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
| Bounded Int Source # | Since: 2.1 |
| Enum Int Source # | Since: 2.1 |
| Eq Int | |
| Integral Int Source # | Since: 2.0.1 |
| Data Int Source # | Since: 4.0.0.0 |
| Num Int Source # | Since: 2.1 |
| Ord Int | |
| Read Int Source # | Since: 2.1 |
| Real Int Source # | Since: 2.0.1 |
| Show Int Source # | Since: 2.1 |
| Ix Int Source # | Since: 2.1 |
| FiniteBits Int Source # | Since: 4.6.0.0 |
| Bits Int Source # | Since: 2.1 |
| Storable Int Source # | Since: 2.1 |
| PrintfArg Int Source # | Since: 2.1 |
| Generic1 k (URec k Int) Source # | |
| Functor (URec * Int) Source # | |
| Foldable (URec * Int) Source # | |
| Traversable (URec * Int) Source # | |
| Eq (URec k Int p) # | |
| Ord (URec k Int p) # | |
| Show (URec k Int p) Source # | |
| Generic (URec k Int p) Source # | |
| data URec k Int Source # | Used for marking occurrences of Since: 4.9.0.0 |
| type Rep1 k (URec k Int) Source # | |
| type Rep (URec k Int p) Source # | |
8-bit signed integer type
Instances
| Bounded Int8 Source # | Since: 2.1 |
| Enum Int8 Source # | Since: 2.1 |
| Eq Int8 Source # | Since: 2.1 |
| Integral Int8 Source # | Since: 2.1 |
| Data Int8 Source # | Since: 4.0.0.0 |
| Num Int8 Source # | Since: 2.1 |
| Ord Int8 Source # | Since: 2.1 |
| Read Int8 Source # | Since: 2.1 |
| Real Int8 Source # | Since: 2.1 |
| Show Int8 Source # | Since: 2.1 |
| Ix Int8 Source # | Since: 2.1 |
| FiniteBits Int8 Source # | Since: 4.6.0.0 |
| Bits Int8 Source # | Since: 2.1 |
| Storable Int8 Source # | Since: 2.1 |
| PrintfArg Int8 Source # | Since: 2.1 |
16-bit signed integer type
Instances
| Bounded Int16 Source # | Since: 2.1 |
| Enum Int16 Source # | Since: 2.1 |
| Eq Int16 Source # | Since: 2.1 |
| Integral Int16 Source # | Since: 2.1 |
| Data Int16 Source # | Since: 4.0.0.0 |
| Num Int16 Source # | Since: 2.1 |
| Ord Int16 Source # | Since: 2.1 |
| Read Int16 Source # | Since: 2.1 |
| Real Int16 Source # | Since: 2.1 |
| Show Int16 Source # | Since: 2.1 |
| Ix Int16 Source # | Since: 2.1 |
| FiniteBits Int16 Source # | Since: 4.6.0.0 |
| Bits Int16 Source # | Since: 2.1 |
| Storable Int16 Source # | Since: 2.1 |
| PrintfArg Int16 Source # | Since: 2.1 |
32-bit signed integer type
Instances
| Bounded Int32 Source # | Since: 2.1 |
| Enum Int32 Source # | Since: 2.1 |
| Eq Int32 Source # | Since: 2.1 |
| Integral Int32 Source # | Since: 2.1 |
| Data Int32 Source # | Since: 4.0.0.0 |
| Num Int32 Source # | Since: 2.1 |
| Ord Int32 Source # | Since: 2.1 |
| Read Int32 Source # | Since: 2.1 |
| Real Int32 Source # | Since: 2.1 |
| Show Int32 Source # | Since: 2.1 |
| Ix Int32 Source # | Since: 2.1 |
| FiniteBits Int32 Source # | Since: 4.6.0.0 |
| Bits Int32 Source # | Since: 2.1 |
| Storable Int32 Source # | Since: 2.1 |
| PrintfArg Int32 Source # | Since: 2.1 |
64-bit signed integer type
Instances
| Bounded Int64 Source # | Since: 2.1 |
| Enum Int64 Source # | Since: 2.1 |
| Eq Int64 Source # | Since: 2.1 |
| Integral Int64 Source # | Since: 2.1 |
| Data Int64 Source # | Since: 4.0.0.0 |
| Num Int64 Source # | Since: 2.1 |
| Ord Int64 Source # | Since: 2.1 |
| Read Int64 Source # | Since: 2.1 |
| Real Int64 Source # | Since: 2.1 |
| Show Int64 Source # | Since: 2.1 |
| Ix Int64 Source # | Since: 2.1 |
| FiniteBits Int64 Source # | Since: 4.6.0.0 |
| Bits Int64 Source # | Since: 2.1 |
| Storable Int64 Source # | Since: 2.1 |
| PrintfArg Int64 Source # | Since: 2.1 |
Notes
- All arithmetic is performed modulo 2^n, where
nis 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
Enuminstances over a bounded type such asInt(see the section of the Haskell report dealing with arithmetic sequences) also hold for theEnuminstances over the variousInttypes 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 == 1in some C implementations.