0e29d6cf615e15eaa7dd163f1f9744efab3f3df5
[ghc-hetmet.git] / ghc / docs / libraries / Int.sgml
1 <sect> <idx/Int/
2 <label id="sec:Int">
3 <p>
4
5 This library provides signed integers of various sizes.  The types
6 supported are as follows:
7
8 <tabular ca="ll">
9 type    | number of bits @ 
10 <!-- <hline>  -->
11 Int8    | 8  @
12 Int16   | 16 @
13 Int32   | 32 @
14 Int64   | 64 @
15 <!-- <hline>  -->
16 </tabular>
17
18 For each type <it/I/ above, we provide the following instances.
19
20 <tscreen><verb>
21 data I            -- Signed Ints
22 iToInt            :: I -> Int  -- not provided for Int64
23 intToI            :: Int -> I  -- not provided for Int64
24 instance Eq       I
25 instance Ord      I
26 instance Show     I
27 instance Read     I
28 instance Bounded  I
29 instance Num      I
30 instance Real     I
31 instance Integral I
32 instance Enum     I
33 instance Ix       I
34 instance Bits     I
35 </verb></tscreen>
36
37 Plus the coercion functions
38
39 <tscreen><verb>
40 int8ToInt16 :: Int8   -> Int16
41 int8ToInt32 :: Int8   -> Int32
42 int8ToInt64 :: Int8   -> Int64
43
44 int16ToInt8  :: Int16 -> Int8
45 int16ToInt32 :: Int16 -> Int32
46 int16ToInt64 :: Int16 -> Int64
47
48 int32ToInt8  :: Int32 -> Int8
49 int32ToInt16 :: Int32 -> Int16
50 int32ToInt64 :: Int32 -> Int64
51
52 int64ToInt8  :: Int64 -> Int8
53 int64ToInt16 :: Int64 -> Int16
54 int64ToInt32 :: Int64 -> Int32
55
56 int8ToInt  :: Int8  -> Int
57 int16ToInt :: Int16 -> Int
58 int32ToInt :: Int32 -> Int
59 int64ToInt :: Int64 -> Int
60
61 intToInt8  :: Int   -> Int8
62 intToInt16 :: Int   -> Int16
63 intToInt32 :: Int   -> Int32
64 intToInt64 :: Int   -> Int64
65
66 integerToInt8  :: Integer -> Int8
67 integerToInt16 :: Integer -> Int16
68 integerToInt32 :: Integer -> Int32
69 integerToInt64 :: Integer -> Int64
70
71 int64ToInteger :: Int64 -> Integer
72 int32ToInteger :: Int32 -> Integer
73 int16ToInteger :: Int16 -> Integer
74 int8ToInteger  :: Int8  -> Integer
75
76 </verb></tscreen>
77
78 <itemize>
79 <item>
80 The rules that hold for <tt/Enum/ instances over a bounded type
81 such as <tt/Int/ (see the section of the Haskell report dealing
82 with arithmetic sequences) also hold for the <tt/Enum/ instances
83 over the various <tt/Int/ types defined here.
84
85 <item>
86 Hugs does not provide <tt/Int64/ at the moment.
87
88 </itemize>