ForeignPtr's - why can't they be passed directly to foreign functions?

Sven Panne Sven.Panne at
Sun Mar 19 06:08:39 EST 2006

Am Mittwoch, 15. März 2006 18:16 schrieb Duncan Coutts:
> On Wed, 2006-03-15 at 17:01 +0000, Brian Hulley wrote:
> > The above two things were what I was expecting the compiler to do for me
> > instead of me having to manually write a wrapper function in Haskell
> > using withForeignPtr for each wrapper function for each foreign
> > function...
> This is exactly the sort of thing that FFI tools automate. Indeed they
> can do this and much more.

Duncan is right here: Our design goal when specifying the FFI was to define 
only those mechanisms which are absolutely necessary to interface to foreign 
languages. Everything which doesn't need any help from the compiler/RTS is 
explicitly left to higher-level tools. The only real redundancy AFAIK is the 
fact the newtypes are "transparent" to the FFI, but this is extremely handy 
and improves type safety and readability quite a bit. I admit being guilty 
for having insisted on that non-minimalistic feature, but I'm proud of 
it... ;-)


More information about the Glasgow-haskell-users mailing list