Proposed change to ForeignPtr

Manuel M T Chakravarty chak at
Mon Aug 12 09:00:22 EDT 2002

We seem to have a consensus on this one.  We change the type
of the existing functions to

  newForeignPtr :: Ptr a -> FunPtr (Ptr a -> IO ()) -> IO (ForeignPtr a)
  addForeignPtrFinalizer :: ForeignPtr a -> FunPtr (Ptr a -> IO ()) -> IO ()

For GHC, I propose to put the closure-based versions into an
extra module (that's easy enough with the hierarchical
libraries).  This makes changing over old code easier, as it
merely requires to alter the import and not all occurences
of the functions.

Any objections?


More information about the FFI mailing list