Remove obsolete `-fno-warn-unused-imports`
[packages/haskell2010.git] / Foreign / C / Types.hs
1 #if __GLASGOW_HASKELL__ >= 701
2 {-# LANGUAGE Safe #-}
3 #endif
4
5 module Foreign.C.Types
6 ( -- * Representations of C types
7 -- $ctypes
8
9 -- ** Integral types
10 -- | These types are are represented as @newtype@s of
11 -- types in "Data.Int" and "Data.Word", and are instances of
12 -- 'Prelude.Eq', 'Prelude.Ord', 'Prelude.Num', 'Prelude.Read',
13 -- 'Prelude.Show', 'Prelude.Enum', 'Storable',
14 -- 'Prelude.Bounded', 'Prelude.Real', 'Prelude.Integral' and
15 -- 'Bits'.
16 CChar, CSChar, CUChar
17 , CShort, CUShort, CInt, CUInt
18 , CLong, CULong
19 , CPtrdiff, CSize, CWchar, CSigAtomic
20 , CLLong, CULLong
21 , CIntPtr, CUIntPtr
22 , CIntMax, CUIntMax
23
24 -- ** Numeric types
25 -- | These types are are represented as @newtype@s of basic
26 -- foreign types, and are instances of
27 -- 'Prelude.Eq', 'Prelude.Ord', 'Prelude.Num', 'Prelude.Read',
28 -- 'Prelude.Show', 'Prelude.Enum' and 'Storable'.
29 , CClock, CTime
30
31 -- ** Floating types
32 -- | These types are are represented as @newtype@s of
33 -- 'Prelude.Float' and 'Prelude.Double', and are instances of
34 -- 'Prelude.Eq', 'Prelude.Ord', 'Prelude.Num', 'Prelude.Read',
35 -- 'Prelude.Show', 'Prelude.Enum', 'Storable',
36 -- 'Prelude.Real', 'Prelude.Fractional', 'Prelude.Floating',
37 -- 'Prelude.RealFrac' and 'Prelude.RealFloat'.
38 , CFloat, CDouble
39 -- GHC doesn't support CLDouble yet
40 #ifdef HASKELL_REPORT
41 , CLDouble
42 #endif
43 -- ** Other types
44
45 -- Instances of: Eq and Storable
46 , CFile, CFpos, CJmpBuf
47
48 ) where
49 import "base" Foreign.C.Types
50
51 {- $ctypes
52
53 These types are needed to accurately represent C function prototypes,
54 in order to access C library interfaces in Haskell. The Haskell system
55 is not required to represent those types exactly as C does, but the
56 following guarantees are provided concerning a Haskell type @CT@
57 representing a C type @t@:
58
59 * If a C function prototype has @t@ as an argument or result type, the
60 use of @CT@ in the corresponding position in a foreign declaration
61 permits the Haskell program to access the full range of values encoded
62 by the C type; and conversely, any Haskell value for @CT@ has a valid
63 representation in C.
64
65 * @'sizeOf' ('Prelude.undefined' :: CT)@ will yield the same value as
66 @sizeof (t)@ in C.
67
68 * @'alignment' ('Prelude.undefined' :: CT)@ matches the alignment
69 constraint enforced by the C implementation for @t@.
70
71 * The members 'peek' and 'poke' of the 'Storable' class map all values
72 of @CT@ to the corresponding value of @t@ and vice versa.
73
74 * When an instance of 'Prelude.Bounded' is defined for @CT@, the values
75 of 'Prelude.minBound' and 'Prelude.maxBound' coincide with @t_MIN@
76 and @t_MAX@ in C.
77
78 * When an instance of 'Prelude.Eq' or 'Prelude.Ord' is defined for @CT@,
79 the predicates defined by the type class implement the same relation
80 as the corresponding predicate in C on @t@.
81
82 * When an instance of 'Prelude.Num', 'Prelude.Read', 'Prelude.Integral',
83 'Prelude.Fractional', 'Prelude.Floating', 'Prelude.RealFrac', or
84 'Prelude.RealFloat' is defined for @CT@, the arithmetic operations
85 defined by the type class implement the same function as the
86 corresponding arithmetic operations (if available) in C on @t@.
87
88 * When an instance of 'Bits' is defined for @CT@, the bitwise operation
89 defined by the type class implement the same function as the
90 corresponding bitwise operation in C on @t@.
91
92 -}