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:

Platform differences

This module contains platform specific information about types.As such, the types presented on this page reflect the platform on which the documentation was generated and may not coincide with the types on your platform.

Integral types

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

newtype CUChar Source #

Haskell type representing the C unsigned char type.(The concrete types of Foreign.C.Types are platform-specific.)

newtype CUInt Source #

Haskell type representing the C unsigned int type.(The concrete types of Foreign.C.Types are platform-specific.)

newtype CULong Source #

Haskell type representing the C unsigned long type.(The concrete types of Foreign.C.Types are platform-specific.)

newtype CULLong Source #

Haskell type representing the C unsigned long long type.(The concrete types of Foreign.C.Types are platform-specific.)

newtype CBool Source #

Haskell type representing the C bool type.(The concrete types of Foreign.C.Types are platform-specific.)

Since: base-4.10.0.0

Numeric types

newtype CUSeconds Source #

Haskell type representing the C useconds_t type.(The concrete types of Foreign.C.Types are platform-specific.)

Since: base-4.4.0.0

newtype CSUSeconds Source #

Haskell type representing the C suseconds_t type.(The concrete types of Foreign.C.Types are platform-specific.)

Since: base-4.4.0.0

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

\t -> posixSecondsToUTCTime (realToFrac t :: POSIXTime)

Floating types

These types are represented as newtypes of[Float](Prelude.html#v:Float "Prelude") and [Double](Prelude.html#v:Double "Prelude"), and are instances of[Eq](Prelude.html#v:Eq "Prelude"), [Ord](Prelude.html#v:Ord "Prelude"), [Num](Prelude.html#v:Num "Prelude"), [Read](Prelude.html#v:Read "Prelude"),[Show](Prelude.html#v:Show "Prelude"), [Enum](Prelude.html#v:Enum "Prelude"), [Typeable](Data-Typeable.html#v:Typeable "Data.Typeable"), [Storable](Foreign-Storable.html#t:Storable "Foreign.Storable"),[Real](Prelude.html#v:Real "Prelude"), [Fractional](Prelude.html#v:Fractional "Prelude"), [Floating](Prelude.html#v:Floating "Prelude"),[RealFrac](Prelude.html#v:RealFrac "Prelude") and [RealFloat](Prelude.html#v:RealFloat "Prelude"). That does mean that [CFloat](Foreign-C-Types.html#t:CFloat "Foreign.C.Types")'s (respectively [CDouble](Foreign-C-Types.html#t:CDouble "Foreign.C.Types")'s) instances of[Eq](Prelude.html#v:Eq "Prelude"), [Ord](Prelude.html#v:Ord "Prelude"), [Num](Prelude.html#v:Num "Prelude") and[Fractional](Prelude.html#v:Fractional "Prelude") are as badly behaved as [Float](Prelude.html#v:Float "Prelude")'s (respectively [Double](Prelude.html#v:Double "Prelude")'s).

Other types