add GHC.HetMet.{hetmet_kappa,hetmet_kappa_app}
[ghc-base.git] / Data / Int.hs
1 {-# LANGUAGE CPP, NoImplicitPrelude #-}
2
3 -----------------------------------------------------------------------------
4 -- |
5 -- Module      :  Data.Int
6 -- Copyright   :  (c) The University of Glasgow 2001
7 -- License     :  BSD-style (see the file libraries/base/LICENSE)
8 -- 
9 -- Maintainer  :  libraries@haskell.org
10 -- Stability   :  experimental
11 -- Portability :  portable
12 --
13 -- Signed integer types
14 --
15 -----------------------------------------------------------------------------
16
17 module Data.Int
18   ( 
19         -- * Signed integer types
20         Int,
21         Int8, Int16, Int32, Int64,
22
23         -- * Notes
24
25         -- $notes
26         ) where
27
28 #ifdef __GLASGOW_HASKELL__
29 import GHC.Base ( Int )
30 import GHC.Int  ( Int8, Int16, Int32, Int64 )
31 #endif
32
33 #ifdef __HUGS__
34 import Hugs.Int ( Int8, Int16, Int32, Int64 )
35 #endif
36
37 #ifdef __NHC__
38 import Prelude
39 import Prelude (Int)
40 import NHC.FFI (Int8, Int16, Int32, Int64)
41 import NHC.SizedTypes (Int8, Int16, Int32, Int64)       -- instances of Bits
42 #endif
43
44 {- $notes
45
46 * All arithmetic is performed modulo 2^n, where @n@ is the number of
47   bits in the type.
48
49 * For coercing between any two integer types, use 'Prelude.fromIntegral',
50   which is specialized for all the common cases so should be fast
51   enough.  Coercing word types (see "Data.Word") to and from integer
52   types preserves representation, not sign.
53
54 * The rules that hold for 'Prelude.Enum' instances over a
55   bounded type such as 'Int' (see the section of the
56   Haskell report dealing with arithmetic sequences) also hold for the
57   'Prelude.Enum' instances over the various
58   'Int' types defined here.
59
60 * Right and left shifts by amounts greater than or equal to the width
61   of the type result in either zero or -1, depending on the sign of
62   the value being shifted.  This is contrary to the behaviour in C,
63   which is undefined; a common interpretation is to truncate the shift
64   count to the width of the type, for example @1 \<\< 32
65   == 1@ in some C implementations.
66 -}