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__
28 import GHC.Base ( Int )
29 import GHC.Int ( Int8, Int16, Int32, Int64 )
33 import Hugs.Int ( Int8, Int16, Int32, Int64 )
38 * All arithmetic is performed modulo 2^n, where @n@ is the number of
41 * For coercing between any two integer types, use 'fromIntegral',
42 which is specialized for all the common cases so should be fast
43 enough. Coercing word types (see "Data.Word") to and from integer
44 types preserves representation, not sign.
46 * The rules that hold for 'Enum' instances over a
47 bounded type such as 'Int' (see the section of the
48 Haskell report dealing with arithmetic sequences) also hold for the
49 'Enum' instances over the various
50 'Int' types defined here.
52 * Right and left shifts by amounts greater than or equal to the width
53 of the type result in either zero or -1, depending on the sign of
54 the value being shifted. This is contrary to the behaviour in C,
55 which is undefined; a common interpretation is to truncate the shift
56 count to the width of the type, for example @1 \<\< 32
57 == 1@ in some C implementations.