| Copyright | (c) The FFI task force 2001 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | ffi@haskell.org |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
Foreign.C.Types
Contents
Description
Mapping of C types to corresponding Haskell types.
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 (undefined :: CT) will yield the same value assizeof (t) in C.alignment (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.Bounded is defined forCT, the values ofminBound andmaxBound coincide witht_MIN andt_MAX in C.Eq orOrd is defined forCT, the predicates defined by the type class implement the same relation as the corresponding predicate in C ont.Num,Read,Integral,Fractional,Floating,RealFrac, orRealFloat 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.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./__
These types are represented asnewtypes of types inData.Int andData.Word, and are instances ofEq,Ord,Num,Read,Show,Enum,Typeable,Storable,Bounded,Real,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.
| BoundedCIntSource# | |
| EnumCIntSource# | |
Instance detailsDefined inForeign.C.Types | |
| EqCIntSource# | |
| IntegralCIntSource# | |
| NumCIntSource# | |
| OrdCIntSource# | |
| ReadCIntSource# | |
| RealCIntSource# | |
| ShowCIntSource# | |
| FiniteBitsCIntSource# | |
Instance detailsDefined inForeign.C.Types | |
| BitsCIntSource# | |
Instance detailsDefined inForeign.C.Types Methods (.&.) ::CInt ->CInt ->CIntSource# (.|.) ::CInt ->CInt ->CIntSource# xor ::CInt ->CInt ->CIntSource# complement ::CInt ->CIntSource# shift ::CInt ->Int ->CIntSource# rotate ::CInt ->Int ->CIntSource# setBit ::CInt ->Int ->CIntSource# clearBit ::CInt ->Int ->CIntSource# complementBit ::CInt ->Int ->CIntSource# testBit ::CInt ->Int ->BoolSource# bitSizeMaybe ::CInt ->MaybeIntSource# shiftL ::CInt ->Int ->CIntSource# unsafeShiftL ::CInt ->Int ->CIntSource# shiftR ::CInt ->Int ->CIntSource# unsafeShiftR ::CInt ->Int ->CIntSource# rotateL ::CInt ->Int ->CIntSource# | |
| StorableCIntSource# | |
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.
newtypeCSigAtomicSource#
Haskell type representing the Csig_atomic_t type.
Constructors
| CSigAtomicInt32 |
Haskell type representing the Clong long type.
Haskell type representing the Cunsigned long long type.
Haskell type representing the Cbool type.
Since: 4.10.0.0
These types are represented asnewtypes of basic foreign types, and are instances ofEq,Ord,Num,Read,Show,Enum,Typeable andStorable.
Haskell type representing the Cclock_t type.
| EnumCClockSource# | |
| EqCClockSource# | |
| NumCClockSource# | |
| OrdCClockSource# | |
| ReadCClockSource# | |
| RealCClockSource# | |
| ShowCClockSource# | |
| StorableCClockSource# | |
Instance detailsDefined inForeign.C.Types | |
Haskell type representing the Ctime_t type.
| EnumCTimeSource# | |
Instance detailsDefined inForeign.C.Types | |
| EqCTimeSource# | |
| NumCTimeSource# | |
| OrdCTimeSource# | |
| ReadCTimeSource# | |
| RealCTimeSource# | |
| ShowCTimeSource# | |
| StorableCTimeSource# | |
Haskell type representing the Cuseconds_t type.
Since: 4.4.0.0
| EnumCUSecondsSource# | |
Instance detailsDefined inForeign.C.Types Methods succ ::CUSeconds ->CUSecondsSource# pred ::CUSeconds ->CUSecondsSource# toEnum ::Int ->CUSecondsSource# fromEnum ::CUSeconds ->IntSource# enumFrom ::CUSeconds -> [CUSeconds]Source# enumFromThen ::CUSeconds ->CUSeconds -> [CUSeconds]Source# enumFromTo ::CUSeconds ->CUSeconds -> [CUSeconds]Source# enumFromThenTo ::CUSeconds ->CUSeconds ->CUSeconds -> [CUSeconds]Source# | |
| EqCUSecondsSource# | |
| NumCUSecondsSource# | |
Instance detailsDefined inForeign.C.Types | |
| OrdCUSecondsSource# | |
Instance detailsDefined inForeign.C.Types | |
| ReadCUSecondsSource# | |
| RealCUSecondsSource# | |
| ShowCUSecondsSource# | |
| StorableCUSecondsSource# | |
Instance detailsDefined inForeign.C.Types Methods sizeOf ::CUSeconds ->IntSource# alignment ::CUSeconds ->IntSource# peekElemOff ::PtrCUSeconds ->Int ->IOCUSecondsSource# pokeElemOff ::PtrCUSeconds ->Int ->CUSeconds ->IO ()Source# peekByteOff ::Ptr b ->Int ->IOCUSecondsSource# pokeByteOff ::Ptr b ->Int ->CUSeconds ->IO ()Source# | |
newtypeCSUSecondsSource#
Haskell type representing the Csuseconds_t type.
Since: 4.4.0.0
Constructors
| CSUSecondsInt64 |
To convertCTime toUTCTime, use the following:
\t -> posixSecondsToUTCTime (realToFrac t :: POSIXTime)
These types are represented asnewtypes ofFloat andDouble, and are instances ofEq,Ord,Num,Read,Show,Enum,Typeable,Storable,Real,Fractional,Floating,RealFrac andRealFloat. That does mean thatCFloat's (respectivelyCDouble's) instances ofEq,Ord,Num andFractional are as badly behaved asFloat's (respectivelyDouble's).
Haskell type representing the Cfloat type.
| EnumCFloatSource# | |
| EqCFloatSource# | |
| FloatingCFloatSource# | |
Instance detailsDefined inForeign.C.Types | |
| FractionalCFloatSource# | |
| NumCFloatSource# | |
| OrdCFloatSource# | |
| ReadCFloatSource# | |
| RealCFloatSource# | |
| RealFloatCFloatSource# | |
Instance detailsDefined inForeign.C.Types Methods floatRadix ::CFloat ->IntegerSource# floatDigits ::CFloat ->IntSource# floatRange ::CFloat -> (Int,Int)Source# decodeFloat ::CFloat -> (Integer,Int)Source# encodeFloat ::Integer ->Int ->CFloatSource# exponent ::CFloat ->IntSource# significand ::CFloat ->CFloatSource# scaleFloat ::Int ->CFloat ->CFloatSource# isInfinite ::CFloat ->BoolSource# isDenormalized ::CFloat ->BoolSource# | |
| RealFracCFloatSource# | |
| ShowCFloatSource# | |
| StorableCFloatSource# | |
Instance detailsDefined inForeign.C.Types | |
Haskell type representing the Cdouble type.
Produced byHaddock version 2.20.0