Foreign.C.Types (original) (raw)
Contents
Description
Mapping of C types to corresponding Haskell types.
Synopsis
- newtype CChar = CChar Int8
- newtype CSChar = CSChar Int8
- newtype CUChar = CUChar Word8
- newtype CShort = CShort Int16
- newtype CUShort = CUShort Word16
- newtype CInt = CInt Int32
- newtype CUInt = CUInt Word32
- newtype CLong = CLong Int64
- newtype CULong = CULong Word64
- newtype CPtrdiff = CPtrdiff Int64
- newtype CSize = CSize Word64
- newtype CWchar = CWchar Int32
- newtype CSigAtomic = CSigAtomic Int32
- newtype CLLong = CLLong Int64
- newtype CULLong = CULLong Word64
- newtype CBool = CBool Word8
- newtype CIntPtr = CIntPtr Int64
- newtype CUIntPtr = CUIntPtr Word64
- newtype CIntMax = CIntMax Int64
- newtype CUIntMax = CUIntMax Word64
- newtype CClock = CClock Int64
- newtype CTime = CTime Int64
- newtype CUSeconds = CUSeconds Word32
- newtype CSUSeconds = CSUSeconds Int64
- newtype CFloat = CFloat Float
- newtype CDouble = CDouble Double
- data CFile
- data CFpos
- data CJmpBuf
Haskell type representing the C unsigned char
type.(The concrete types of Foreign.C.Types are platform-specific.)
Haskell type representing the C unsigned int
type.(The concrete types of Foreign.C.Types are platform-specific.)
Haskell type representing the C unsigned long
type.(The concrete types of Foreign.C.Types are platform-specific.)
Haskell type representing the C sig_atomic_t
type.(The concrete types of Foreign.C.Types are platform-specific.) See Note [Lack of signals on wasm32-wasi].
Haskell type representing the C unsigned long long
type.(The concrete types of Foreign.C.Types are platform-specific.)
Haskell type representing the C bool
type.(The concrete types of Foreign.C.Types are platform-specific.)
Since: base-4.10.0.0
These types are represented as newtype
s of basic foreign types, 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")
andStorable
.
Haskell type representing the C useconds_t
type.(The concrete types of Foreign.C.Types are platform-specific.)
Since: base-4.4.0.0
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)
These types are represented as newtype
s 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
,[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).