withFile defeats dead handle closure

David Feuer david.feuer at gmail.com
Wed Dec 30 19:23:20 UTC 2020


withFile keeps the handle it creates alive until the user action completes.
If we want to avoid this, we can. All that's required is to capture the
weak reference that holds the handle's finalizer. Then instead of closing
the handle in the end (or on exception) using hClose, withFile can run the
handle's finalizer. Should we do this? Or does it run too much against the
idea that handles should be managed as explicitly as possible?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20201230/1ccdf72c/attachment.html>


More information about the Libraries mailing list