[Haskell-cafe] Re: allocation for "pure" FFI functions
waldmann at imn.htwk-leipzig.de
Fri Oct 15 05:24:08 EDT 2010
Duncan Coutts <duncan.coutts <at> googlemail.com> writes:
> It is exactly for this purpose that the Haskell FFI library includes
> unsafePerformIO. This is basically *the* legitimate use case for it, so
> you don't need to feel bad about it.
OK, thanks. Then this means my C type is a ForeignPtr,
and each time I use it (even read-only) it looks like
unsafePerformIO $ withForeignPtr $ \ p -> ...
Meanwhile I think I found a nice example and explanation here:
More information about the Haskell-Cafe