In article <200306091001.51091.alastair@reid-consulting-uk.ltd.uk>, Alastair Reid <alastair@reid-consulting-uk.ltd.uk> wrote:
It looks like you're using an idiom we didn't think of when designing the library. Can you explain what you're trying to do and whether you think we shoud provide direct support for newSimpleForeignPtr (which I'd be tempted to call newForeignPtr_).
Specifically I want a ForeignPtr of a null Ptr that has no finalizers. I want a value of type ForeignPtr such that withForeignPtr will extract a null Ptr. My basic JNI ref type is newtype of a ForeignPtr. JNI gives me "global references" as Ptrs, and I wrap them in ForeignPtrs with a finalizer that tells the Java VM I'm finished with it. When I want to pass such a ref back to JNI, I simply call withForeignPtr to extract the underlying Ptr. But sometimes I want to create my own null references. Before GHC 6.0, I used to call (newForeignPtr nullPtr (return ())), and that would give me a ForeignPtr that would work with withForeignPtr to give a null Ptr. But now I can't. -- Ashley Yakeley, Seattle WA