The Revenge of Finalizers

George Russell ger at
Thu Oct 17 06:23:26 EDT 2002

Simon Marlow wrote:
> > I'd hoped that blockFinalizers would be useful for defining other
> > primitives but since it won't even work for GHC, I agree that PVar
> > will meet most of our needs.  (An even simpler design might be to
> > extend our IORef implementations with 'atomicallyModifyIORef'.)
> >
> > So, is this a design that we could agree on?
> I like it.  I'd vote for 'atomicModifyIORef' rather than a new PVar
> type, though.
Yes, I think I would too.  So that's the end of PVars.

Just to check, is there any problem implementing

atomicModifyIORef :: IORef a -> (a -> (a,b)) -> IO b?

(Especially for NHC?)  Because that's the type I would like it to have.
I can see a number of applications for this function . .

More information about the FFI mailing list