8 Jul
2003
8 Jul
'03
2:31 a.m.
the discussion on ForeignPtrs without finalizers didn't come to a conclusion. I specifically need the nullForeignPtr which was easy enough with the FFI of GHC 5.04: [...] do I have to create a dummy C function?
Yes, create a dummy C function. (Actually, you could use 'free' since it does nothing if passed NULL.) -- Alastair ps Personally, I would use Maybe (ForeignPtr a) in the places where you are currently using a ForeignPtr which could be null with 'Just x' being used only when x is not null. I haven't tried exactly this but I have lots of experience using Maybe (Ptr a) in this way and it works great: Haskell's type system catches errors that would be runtime errors in C.