[Haskell-cafe] make an PrimMonad-wrapped FFI call

Alexey Egorov electreg at list.ru
Sun Oct 18 02:37:45 UTC 2015

 Hello haskellers,

I'm writing FFI bindings to C library which uses some allocations across functions call, for example:

int *alloc_buf(void);
void free_buf(int *);

So I need to use newForeignPtr to make sure buffer will be free'd when all pointers to it get collected.
But what if I want to do this in PrimMonad (say, ST) and not IO (returned by newForeignPtr)?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151018/fec51151/attachment.html>

More information about the Haskell-Cafe mailing list