[Haskell-cafe] safe code to run in finalizers: ACIO revisited

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sat Dec 18 15:19:31 EST 2004

Robert Dockins <robdockins at fastmail.fm> writes:

> So, to be safe, the action of a finalizer must commute with every
> other finalizer (they must be central).

What does "should" mean? There are useful finalizers which don't have
this property. E.g. a finalizer can remove an entry from a weak
dictionary, call a C function which will free some foreign object,
or send a message over a network that a particular object is no longer
needed. Even if they have these properties in an abstract sense, they
are not true technically.

> So a separate ACIO monad for affine central IO actions would be the
> appropriate context for finalizers.

It would not be enough without unsafeIOtoACIO.

   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/

More information about the Haskell-Cafe mailing list