[Haskell-cafe] Bulletproof resource management

Michael Snoyman michael at snoyman.com
Sat Oct 16 12:19:44 EDT 2010


On Fri, Oct 15, 2010 at 8:17 PM, Antoine Latter <aslatter at gmail.com> wrote:
> On Fri, Oct 15, 2010 at 11:09 AM, Florian Weimer <fw at deneb.enyo.de> wrote:
>> * Henning Thielemann:
>>
>>> Some open/close pairs have corresponding 'with' functions, that are
>>> implemented using Exception.bracket. You can also use them within
>>> GHCi. I think using both manual resource deallocation and finalizers
>>> makes everything more complicated and more unreliable.
>>
>> It seems that Exception.bracket does not work in all cases, see the
>> recent "MonadCatchIO, finally and the error monad" thread.
>>
>> Anyway, the ability of closures (and threads) means that something
>> like Exception.bracket does not prevent access to closed handles, so
>> I still need an additional safety net.
>
> That thread is for the function "bracket" provided by the package
> MonadCatchIO. Control.Exception.bracket should work fine as far as I
> know.

I can confer that when I brought up the issue with bracket, it's only
referring to the function exported by MonadCatchIO. I sure as hell
hope The Control.Exception version always works properly ;).

Michael


More information about the Haskell-Cafe mailing list