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

Maurí­cio briqueabraque at yahoo.com
Tue Feb 10 15:56:40 EST 2009

Yes, I can. Thanks. Just forget my idea, with
this I can provide all those types in a library.

I'm confused. When is it possible to use a type
as a parameter to a foreign function call? My
first guess was that I had to provide an instance
for class Storable, but after I tried writing
a complex-like type that way GHC told me my type
was unaceptable. So I thought only types allowed
by the compiler (including forall a. Ptr a) could
be used that way.

What is the rule? I've read all of FFI report
and found nothing. Did I miss something? How can
I make a type of mine acceptable? Why are
Data.Int acceptable, and how could I know that?


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

>> 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
>> (...)

More information about the Haskell-Cafe mailing list