Movatterモバイル変換


[0]ホーム

URL:


base-4.4.0.0: Basic libraries

Portabilityportable
Stabilityprovisional
Maintainerffi@haskell.org

Foreign.C.Types

Contents

Description

Mapping of C types to corresponding Haskell types.

Synopsis

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 systemis not required to represent those types exactly as C does, but thefollowing guarantees are provided concerning a Haskell typeCTrepresenting a C typet:

  • If a C function prototype hast 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.
  • The memberspeek andpoke of theStorable class map all values ofCT to the corresponding value oft and vice versa.
  • When an instance ofPrelude.Bounded is defined forCT, the values ofPrelude.minBound andPrelude.maxBound coincide witht_MIN andt_MAX in C.
  • When an instance ofPrelude.Eq orPrelude.Ord is defined forCT, the predicates defined by the type class implement the same relation as the corresponding predicate in C ont.
  • When an instance ofPrelude.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.
  • When an instance ofBits is defined forCT, the bitwise operation defined by the type class implement the same function as the corresponding bitwise operation in C ont.

Integral types

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.

dataCCharSource

Haskell type representing the Cchar type.

Instances

BoundedCChar 
EnumCChar 
EqCChar 
IntegralCChar 
NumCChar 
OrdCChar 
ReadCChar 
RealCChar 
ShowCChar 
TypeableCChar 
BitsCChar 
StorableCChar 

dataCSCharSource

Haskell type representing the Csigned char type.

Instances

BoundedCSChar 
EnumCSChar 
EqCSChar 
IntegralCSChar 
NumCSChar 
OrdCSChar 
ReadCSChar 
RealCSChar 
ShowCSChar 
TypeableCSChar 
BitsCSChar 
StorableCSChar 

dataCUCharSource

Haskell type representing the Cunsigned char type.

Instances

BoundedCUChar 
EnumCUChar 
EqCUChar 
IntegralCUChar 
NumCUChar 
OrdCUChar 
ReadCUChar 
RealCUChar 
ShowCUChar 
TypeableCUChar 
BitsCUChar 
StorableCUChar 

dataCShortSource

Haskell type representing the Cshort type.

Instances

BoundedCShort 
EnumCShort 
EqCShort 
IntegralCShort 
NumCShort 
OrdCShort 
ReadCShort 
RealCShort 
ShowCShort 
TypeableCShort 
BitsCShort 
StorableCShort 

dataCUShortSource

Haskell type representing the Cunsigned short type.

Instances

BoundedCUShort 
EnumCUShort 
EqCUShort 
IntegralCUShort 
NumCUShort 
OrdCUShort 
ReadCUShort 
RealCUShort 
ShowCUShort 
TypeableCUShort 
BitsCUShort 
StorableCUShort 

dataCIntSource

Haskell type representing the Cint type.

Instances

BoundedCInt 
EnumCInt 
EqCInt 
IntegralCInt 
NumCInt 
OrdCInt 
ReadCInt 
RealCInt 
ShowCInt 
TypeableCInt 
BitsCInt 
StorableCInt 

dataCUIntSource

Haskell type representing the Cunsigned int type.

Instances

BoundedCUInt 
EnumCUInt 
EqCUInt 
IntegralCUInt 
NumCUInt 
OrdCUInt 
ReadCUInt 
RealCUInt 
ShowCUInt 
TypeableCUInt 
BitsCUInt 
StorableCUInt 

dataCLongSource

Haskell type representing the Clong type.

Instances

BoundedCLong 
EnumCLong 
EqCLong 
IntegralCLong 
NumCLong 
OrdCLong 
ReadCLong 
RealCLong 
ShowCLong 
TypeableCLong 
BitsCLong 
StorableCLong 

dataCULongSource

Haskell type representing the Cunsigned long type.

Instances

BoundedCULong 
EnumCULong 
EqCULong 
IntegralCULong 
NumCULong 
OrdCULong 
ReadCULong 
RealCULong 
ShowCULong 
TypeableCULong 
BitsCULong 
StorableCULong 

dataCPtrdiffSource

Haskell type representing the Cptrdiff_t type.

Instances

BoundedCPtrdiff 
EnumCPtrdiff 
EqCPtrdiff 
IntegralCPtrdiff 
NumCPtrdiff 
OrdCPtrdiff 
ReadCPtrdiff 
RealCPtrdiff 
ShowCPtrdiff 
TypeableCPtrdiff 
BitsCPtrdiff 
StorableCPtrdiff 

dataCSizeSource

Haskell type representing the Csize_t type.

Instances

BoundedCSize 
EnumCSize 
EqCSize 
IntegralCSize 
NumCSize 
OrdCSize 
ReadCSize 
RealCSize 
ShowCSize 
TypeableCSize 
BitsCSize 
StorableCSize 

dataCWcharSource

Haskell type representing the Cwchar_t type.

Instances

BoundedCWchar 
EnumCWchar 
EqCWchar 
IntegralCWchar 
NumCWchar 
OrdCWchar 
ReadCWchar 
RealCWchar 
ShowCWchar 
TypeableCWchar 
BitsCWchar 
StorableCWchar 

dataCSigAtomicSource

Haskell type representing the Csig_atomic_t type.

Instances

BoundedCSigAtomic 
EnumCSigAtomic 
EqCSigAtomic 
IntegralCSigAtomic 
NumCSigAtomic 
OrdCSigAtomic 
ReadCSigAtomic 
RealCSigAtomic 
ShowCSigAtomic 
TypeableCSigAtomic 
BitsCSigAtomic 
StorableCSigAtomic 

dataCLLongSource

Haskell type representing the Clong long type.

Instances

BoundedCLLong 
EnumCLLong 
EqCLLong 
IntegralCLLong 
NumCLLong 
OrdCLLong 
ReadCLLong 
RealCLLong 
ShowCLLong 
TypeableCLLong 
BitsCLLong 
StorableCLLong 

dataCULLongSource

Haskell type representing the Cunsigned long long type.

Instances

BoundedCULLong 
EnumCULLong 
EqCULLong 
IntegralCULLong 
NumCULLong 
OrdCULLong 
ReadCULLong 
RealCULLong 
ShowCULLong 
TypeableCULLong 
BitsCULLong 
StorableCULLong 

dataCIntPtrSource

Instances

BoundedCIntPtr 
EnumCIntPtr 
EqCIntPtr 
IntegralCIntPtr 
NumCIntPtr 
OrdCIntPtr 
ReadCIntPtr 
RealCIntPtr 
ShowCIntPtr 
TypeableCIntPtr 
BitsCIntPtr 
StorableCIntPtr 

dataCUIntPtrSource

Instances

BoundedCUIntPtr 
EnumCUIntPtr 
EqCUIntPtr 
IntegralCUIntPtr 
NumCUIntPtr 
OrdCUIntPtr 
ReadCUIntPtr 
RealCUIntPtr 
ShowCUIntPtr 
TypeableCUIntPtr 
BitsCUIntPtr 
StorableCUIntPtr 

dataCIntMaxSource

Instances

BoundedCIntMax 
EnumCIntMax 
EqCIntMax 
IntegralCIntMax 
NumCIntMax 
OrdCIntMax 
ReadCIntMax 
RealCIntMax 
ShowCIntMax 
TypeableCIntMax 
BitsCIntMax 
StorableCIntMax 

dataCUIntMaxSource

Instances

BoundedCUIntMax 
EnumCUIntMax 
EqCUIntMax 
IntegralCUIntMax 
NumCUIntMax 
OrdCUIntMax 
ReadCUIntMax 
RealCUIntMax 
ShowCUIntMax 
TypeableCUIntMax 
BitsCUIntMax 
StorableCUIntMax 

Numeric types

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.

dataCClockSource

Haskell type representing the Cclock_t type.

Instances

EnumCClock 
EqCClock 
NumCClock 
OrdCClock 
ReadCClock 
RealCClock 
ShowCClock 
TypeableCClock 
StorableCClock 

dataCTimeSource

Haskell type representing the Ctime_t type.

Instances

EnumCTime 
EqCTime 
NumCTime 
OrdCTime 
ReadCTime 
RealCTime 
ShowCTime 
TypeableCTime 
StorableCTime 

dataCUSecondsSource

Haskell type representing the Cuseconds_t type.

Instances

EnumCUSeconds 
EqCUSeconds 
NumCUSeconds 
OrdCUSeconds 
ReadCUSeconds 
RealCUSeconds 
ShowCUSeconds 
TypeableCUSeconds 
StorableCUSeconds 

dataCSUSecondsSource

Haskell type representing the Csuseconds_t type.

Instances

EnumCSUSeconds 
EqCSUSeconds 
NumCSUSeconds 
OrdCSUSeconds 
ReadCSUSeconds 
RealCSUSeconds 
ShowCSUSeconds 
TypeableCSUSeconds 
StorableCSUSeconds 

To convertCTime toData.Time.UTCTime, use the following formula:

  posixSecondsToUTCTime (realToFrac :: POSIXTime)

Floating types

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.

dataCFloatSource

Haskell type representing the Cfloat type.

Instances

EnumCFloat 
EqCFloat 
FloatingCFloat 
FractionalCFloat 
NumCFloat 
OrdCFloat 
ReadCFloat 
RealCFloat 
RealFloatCFloat 
RealFracCFloat 
ShowCFloat 
TypeableCFloat 
StorableCFloat 

dataCDoubleSource

Haskell type representing the Cdouble type.

Instances

EnumCDouble 
EqCDouble 
FloatingCDouble 
FractionalCDouble 
NumCDouble 
OrdCDouble 
ReadCDouble 
RealCDouble 
RealFloatCDouble 
RealFracCDouble 
ShowCDouble 
TypeableCDouble 
StorableCDouble 

Other types

dataCFileSource

Haskell type representing the CFILE type.

dataCFposSource

Haskell type representing the Cfpos_t type.

dataCJmpBufSource

Haskell type representing the Cjmp_buf type.

Produced byHaddock version 2.9.2


[8]ページ先頭

©2009-2025 Movatter.jp