[Haskell-cafe] foreign function types
Eyal Lotem
eyal.lotem at gmail.com
Mon Jan 26 23:32:47 EST 2009
I have encountered quite a bit of bugs in foreign bindings where "Int" was
used in place of "Cint".
As far as I know, no foreign function should ever take a Haskell Int, only
CInts.
Would it be possible to create an empty type-class of which various
C-acceptable types are instances (e.g CInt, CString) but Haskell types
aren't (Ints)?
I am not sure this is the right solution, but I think the problem of
accidentally using Int in place of CInt should be solved so that
compile-time errors are received, as for x86-32 systems, no compile time or
even runtime error will be issued. It will wait and crash when run on an
x86-64 system.
Eyal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090127/bc2e7b56/attachment.htm
More information about the Haskell-Cafe
mailing list