1 {-# LANGUAGE CPP, PackageImports #-}

3 {-# LANGUAGE Safe #-}

4 #endif

7 -- * Signed integer types

9 -- $notes

17 -- SDM: removed after 'Prelude.fromIntegral':

18 -- ..., which is specialized for all the common cases

19 -- so should be fast enough

21 {- $notes

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.

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.

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.

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 -}