Tue, 28 Mar 2000 02:22:46 +1000, Fergus Henderson <[EMAIL PROTECTED]> pisze:

> This mapping assumes that you want the unboxed types in C. What if
> you want to pass an unevaluated closure (e.g. so that you can later
> pass it back to Haskell and then evaluate it)?

StablePtr is already there.

> What about Bool, lists, tuples, Array, Integer, Maybe, Either, ...?

The new ISO C defines the type _Bool and its alias bool in <stdbool.h>.

...but as I understand it, these types will be simply handled in
a higher level library.

> Are there any requirements on what kinds of types the Haskell types
> map to? For example, is it OK for all these Haskell types to map to
> opaque struct types in C?  If not, what exactly are the requirements?

IMHO it should be said that integral types map to C's integral types,
so C's type conversions can be used. Similarly for floating points.
And HsAddr could be required to be void *.

> What should happen with Int64 and Word64 if the C implementation
> does not support any 64-bit integer type?

Fortunately the new ISO C requires providing int_least64_t in
<stdint.h>.

> > 3) Addr can be used for all kinds of C pointers.
> 
> That approach compromises strong typing.
> 
> It would be better to have a polymorphic Haskell type corresponding
> to C pointers.

What about pointers to structures? Arbitrary structures are not
mapped to Haskell types. And structures are almost always used through
pointers, so it's not needed apart from providing an artificial type
as the argument to Addr. So I'm not sure it's worth doing. And what
about pointers used as pointers to arrays?

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-


Reply via email to