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)?
Thanks.