| Portability | portable |
|---|---|
| Stability | provisional |
| Maintainer | ffi@haskell.org |
Foreign.C.Types
Description
Mapping of C types to corresponding Haskell types.
Synopsis
These types are needed to accurately represent C function prototypes,in order to access C library interfaces in Haskell. The Haskell systemis not required to represent those types exactly as C does, but thefollowing guarantees are provided concerning a Haskell typeCTrepresenting a C typet:
t as an argument or result type, the use ofCT in the corresponding position in a foreign declaration permits the Haskell program to access the full range of values encoded by the C type; and conversely, any Haskell value forCT has a valid representation in C.sizeOf (Prelude.undefined :: CT) will yield the same value assizeof (t) in C.alignment (Prelude.undefined :: CT) matches the alignment constraint enforced by the C implementation fort.peek andpoke of theStorable class map all values ofCT to the corresponding value oft and vice versa.Prelude.Bounded is defined forCT, the values ofPrelude.minBound andPrelude.maxBound coincide witht_MIN andt_MAX in C.Prelude.Eq orPrelude.Ord is defined forCT, the predicates defined by the type class implement the same relation as the corresponding predicate in C ont.Prelude.Num,Prelude.Read,Prelude.Integral,Prelude.Fractional,Prelude.Floating,Prelude.RealFrac, orPrelude.RealFloat is defined forCT, the arithmetic operations defined by the type class implement the same function as the corresponding arithmetic operations (if available) in C ont.Bits is defined forCT, the bitwise operation defined by the type class implement the same function as the corresponding bitwise operation in C ont.These types are are represented asnewtypes of types inData.Int andData.Word, and are instances ofPrelude.Eq,Prelude.Ord,Prelude.Num,Prelude.Read,Prelude.Show,Prelude.Enum,Typeable,Storable,Prelude.Bounded,Prelude.Real,Prelude.Integral andBits.
Haskell type representing the Cchar type.
Haskell type representing the Csigned char type.
Haskell type representing the Cunsigned char type.
Haskell type representing the Cshort type.
Haskell type representing the Cunsigned short type.
Haskell type representing the Cint type.
Haskell type representing the Cunsigned int type.
Haskell type representing the Clong type.
Haskell type representing the Cunsigned long type.
Haskell type representing the Cptrdiff_t type.
Haskell type representing the Csize_t type.
Haskell type representing the Cwchar_t type.
dataCSigAtomicSource
Haskell type representing the Csig_atomic_t type.
Haskell type representing the Clong long type.
Haskell type representing the Cunsigned long long type.
These types are are represented asnewtypes of basic foreign types, and are instances ofPrelude.Eq,Prelude.Ord,Prelude.Num,Prelude.Read,Prelude.Show,Prelude.Enum,Typeable andStorable.
Haskell type representing the Cclock_t type.
Haskell type representing the Ctime_t type.
Haskell type representing the Cuseconds_t type.
dataCSUSecondsSource
Haskell type representing the Csuseconds_t type.
To convertCTime toData.Time.UTCTime, use the following formula:
posixSecondsToUTCTime (realToFrac :: POSIXTime)
These types are are represented asnewtypes ofPrelude.Float andPrelude.Double, and are instances ofPrelude.Eq,Prelude.Ord,Prelude.Num,Prelude.Read,Prelude.Show,Prelude.Enum,Typeable,Storable,Prelude.Real,Prelude.Fractional,Prelude.Floating,Prelude.RealFrac andPrelude.RealFloat.
Haskell type representing the Cfloat type.
Haskell type representing the Cdouble type.
Produced byHaddock version 2.9.2