Foreign.C.Types (original) (raw)

Representations of C types

These types are needed to accurately represent C function prototypes, in order to access C library interfaces in Haskell. The Haskell system is not required to represent those types exactly as C does, but the following guarantees are provided concerning a Haskell type CTrepresenting a C type t:

Integral types

These types are are represented as newtypes of types in Data.Int and Data.Word, and are instances of[Eq](Prelude.html#t:Eq), [Ord](Prelude.html#t:Ord), [Num](Prelude.html#t:Num), [Read](Prelude.html#t:Read),[Show](Prelude.html#t:Show), [Enum](Prelude.html#t:Enum), [Typeable](Data-Typeable-Internal.html#t:Typeable), [Storable](Foreign-Storable.html#t:Storable),[Bounded](Prelude.html#t:Bounded), [Real](Prelude.html#t:Real), [Integral](Prelude.html#t:Integral) and[Bits](Data-Bits.html#t:Bits).

newtype CChar Source

Haskell type representing the C char type.

newtype CSChar Source

Haskell type representing the C signed char type.

newtype CUChar Source

Haskell type representing the C unsigned char type.

newtype CShort Source

Haskell type representing the C short type.

newtype CUShort Source

Haskell type representing the C unsigned short type.

newtype CInt Source

Haskell type representing the C int type.

newtype CUInt Source

Haskell type representing the C unsigned int type.

newtype CLong Source

Haskell type representing the C long type.

newtype CULong Source

Haskell type representing the C unsigned long type.

newtype CPtrdiff Source

Haskell type representing the C ptrdiff_t type.

newtype CSize Source

Haskell type representing the C size_t type.

newtype CWchar Source

Haskell type representing the C wchar_t type.

newtype CLLong Source

Haskell type representing the C long long type.

newtype CULLong Source

Haskell type representing the C unsigned long long type.

Numeric types

newtype CClock Source

Haskell type representing the C clock_t type.

newtype CTime Source

Haskell type representing the C time_t type.

To convert [CTime](Foreign-C-Types.html#t:CTime) to [UTCTime](Data-Time.html#t:UTCTime), use the following formula:

posixSecondsToUTCTime (realToFrac :: POSIXTime)

Floating types

These types are are represented as newtypes of[Float](Prelude.html#t:Float) and [Double](Prelude.html#t:Double), and are instances of[Eq](Prelude.html#t:Eq), [Ord](Prelude.html#t:Ord), [Num](Prelude.html#t:Num), [Read](Prelude.html#t:Read),[Show](Prelude.html#t:Show), [Enum](Prelude.html#t:Enum), [Typeable](Data-Typeable-Internal.html#t:Typeable), [Storable](Foreign-Storable.html#t:Storable),[Real](Prelude.html#t:Real), [Fractional](Prelude.html#t:Fractional), [Floating](Prelude.html#t:Floating),[RealFrac](Prelude.html#t:RealFrac) and [RealFloat](Prelude.html#t:RealFloat).

newtype CFloat Source

Haskell type representing the C float type.

newtype CDouble Source

Haskell type representing the C double type.

Other types

data CFile Source

Haskell type representing the C FILE type.

data CFpos Source

Haskell type representing the C fpos_t type.