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: http://en.wikibooks.org/wiki/Haskell/FFI#Self-Deallocating_Pointers J.W. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe