1 {-# OPTIONS -fno-implicit-prelude #-}
2 -----------------------------------------------------------------------------
5 -- Copyright : (c) The University of Glasgow 2001
6 -- License : BSD-style (see the file libraries/base/LICENSE)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : experimental
10 -- Portability : portable
12 -- Signed integer types
14 -----------------------------------------------------------------------------
18 -- * Signed integer types
20 Int8, Int16, Int32, Int64,
27 #ifdef __GLASGOW_HASKELL__
33 * All arithmetic is performed modulo 2^n, where @n@ is the number of
36 * For coercing between any two integer types, use 'fromIntegral',
37 which is specialized for all the common cases so should be fast
38 enough. Coercing word types (see "Data.Word") to and from integer
39 types preserves representation, not sign.
41 * The rules that hold for 'Enum' instances over a
42 bounded type such as 'Int' (see the section of the
43 Haskell report dealing with arithmetic sequences) also hold for the
44 'Enum' instances over the various
45 'Int' types defined here.
47 * Right and left shifts by amounts greater than or equal to the width
48 of the type result in either zero or -1, depending on the sign of
49 the value being shifted. This is contrary to the behaviour in C,
50 which is undefined; a common interpretation is to truncate the shift
51 count to the width of the type, for example @1 \<\< 32
52 == 1@ in some C implementations.