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

Ross Mellgren rmm-haskell at z.odi.ac
Tue Feb 10 11:32:49 EST 2009

I think you can use Data.Word and Data.Int types for this, that is.

Data.Word.Word16 == uint16_t, Data.Word.Word32 == uint32_t, etc.
Data.Int.Int16 = int16_t, Data.Int.Int32 = int32_t, etc.

There are Foreign.Storable.Storable instances for those.


On Feb 10, 2009, at 6:32 AM, Maurí cio wrote:

> 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list