An IOFinalizer has an associated IO action that is automatically called whenever the finalizer is garbage collected. The action can be run and cleared prematurely.
You can hold a reference to the finalizer in your data structure, if the data structure gets garbage collected the finalizer will be called.
It is implemented using mkWeakIORef.
Pre-release
Constructors
IOFinalizer (IORef (Maybe (IO ())))