new ForeignPtr without finalizers

Manuel M T Chakravarty chak at cse.unsw.edu.au
Thu Jun 12 00:29:06 EDT 2003


Dean Herington <heringto at cs.unc.edu> wrote,

> Alastair Reid wrote:
> 
> > I'm not convinced that merging them into a single function is desirable, but,
> > if we wanted to, I think a better FPish solution is to use
> >
> >   Maybe (FinalizerPtr a)
> 
> As multiple finalizers are allowed, perhaps we should consider:
> 
> newForeignPtr :: [FinalizerPtr a] -> Ptr a -> IO (ForeignPtr a)
> addForeignPtrFinalizers :: [FinalizerPtr a] -> ForeignPtr a -> IO ()

True, but it would also break old code and I doubt that
users would often add more than one finaliser at a time.

Cheers,
Manuel



More information about the FFI mailing list