4.5. CTypes

This module is part of the language-dependent part of the Foreign Function Interface (FFI) - for the language-independent part, see Section 4.9. It defines Haskell types that can hold the primitive types of C and can directly be used in foreign import and export declarations.

Every type has a constructor of the same name, which is currently exported, too. Given the large set of instances for each type, it is not clear if access to the concrete representation is really necessary. Some experience is needed before a final decision can be made in this respect.

4.5.1. Integral types

The following integral types have instances for the classes Eq, Ord, Num, Read, Show, Enum, Typeable, Storable, Bounded, Real, Integral, and Bits:

newtype CChar		-- char
newtype CSChar		-- signed char
newtype CUChar		-- unsigned char
newtype CShort		-- short
newtype CUShort		-- unsigned short
newtype CInt		-- int
newtype CUInt		-- unsigned int
newtype CLong		-- long
newtype CULong		-- unsigned long
newtype CLLong		-- long long
newtype CULLong		-- unsigned long long

4.5.2. Floating types

The following floating types have instances for the classes Eq, Ord, Num, Read, Show, Enum, Typeable, Storable, Real, Fractional, Floating, RealFrac, and RealFloat:

newtype CFloat		-- float
newtype CDouble		-- double
newtype CLDouble	-- long double