Add explicit `{-# LANGUAGE CPP, PackageImports #-}` pragmas
[packages/haskell2010.git] / Data / Int.hs
1 {-# LANGUAGE CPP, PackageImports #-}
2 #if __GLASGOW_HASKELL__ >= 701
3 {-# LANGUAGE Safe #-}
4 #endif
5
6 module Data.Int (
7 -- * Signed integer types
8
9 -- $notes
10
11 Int,
12 Int8, Int16, Int32, Int64,
13
14 ) where
15 import "base" Data.Int
16
17 -- SDM: removed after 'Prelude.fromIntegral':
18 -- ..., which is specialized for all the common cases
19 -- so should be fast enough
20
21 {- $notes
22
23 This module provides signed integer types of unspecified width ('Int')
24 and fixed widths ('Int8', 'Int16', 'Int32' and 'Int64'). All
25 arithmetic is performed modulo 2^n, where @n@ is the number of bits in
26 the type.
27
28 For coercing between any two integer types, use
29 'Prelude.fromIntegral'. Coercing word types (see "Data.Word") to and
30 from integer types preserves representation, not sign.
31
32 The rules that hold for 'Prelude.Enum' instances over a bounded type
33 such as 'Int' (see the section of the Haskell language report dealing with
34 arithmetic sequences) also hold for the 'Prelude.Enum' instances over
35 the various 'Int' types defined here.
36
37 Right and left shifts by amounts greater than or equal to the width of
38 the type result in either zero or -1, depending on the sign of the
39 value being shifted. This is contrary to the behaviour in C, which is
40 undefined; a common interpretation is to truncate the shift count to
41 the width of the type, for example @1 \<\< 32 == 1@ in some C
42 implementations.
43 -}
44