[Haskell-cafe] Additonal types for Foreign.C.Types

Maurí­cio briqueabraque at yahoo.com
Tue Feb 10 06:32:49 EST 2009


Hi,

After reading an ISO draft for standard C, I found
a few types that could be usefull when binding to
libraries (these are from <stdint.h>):

int8_t, uint8_t, int16_t, uint16_t, int32_t,
uint32_t, int64_t, uint64_t

What about if they were included in the next version
of GHC Foreign.C.Types module? For instance, as:

CInt8, CUInt8, CInt16 etc.

Some libraries (e.g. sqlite) define function parameters
that are supposed to always have a given size (e.g.,
sqlite defines sqlite3_int64). In order to have a
portable binding to those libraries, it would be nice
to have types in Haskell that also offer that guarantee.

There are also a few other nice types, although I'm not
sure they belong to standard modules. If they did,
however, they could make life easier for those people
writing higher level Haskell modules after standard
C functions:

complex, float complex, double complex (from <complex.h>)
are used in functions like ccos, csin, cexp, csqrt etc.

struct lconv (from <locale.h>)

struct tm (from <time.h>)

 From <wchar.h> and <wctype.h>: mbstate_t, wint_t,
wctrans_t, wctype_t.

Do you think I could open a ticket for GHC proposing
that?

Best,
Maurício



More information about the Haskell-Cafe mailing list