Final bikeshedding call: Fixing Control.Exception.bracket

Yuras Shumovich shumovichy at gmail.com
Fri Nov 14 12:24:46 UTC 2014


On Fri, 2014-11-14 at 13:33 +0200, Eyal Lotem wrote:
> On Fri, Nov 14, 2014 at 2:56 AM, Yuras Shumovich <shumovichy at gmail.com>
> wrote:
> > You are missing the point. Async exception can interrupt "withFile" in
> > acquire, cleanup or body, and you can't rely on any particular case. So
> > there should not be any difference whether write to the handle was lost
> > because of hPutStr was interrupted, or because hClose failed to flush
> > buffers. withFile doesn't provide atomic guaranties.
> >
> 
> You misunderstand me. With your proposal for hClose and current bracket,
> users would no longer have any useful guarantee about *success* results
> from writes to handles *inside* the withFile bracket. But I think the
> entire discussion focused too much on hClose whereas other examples make
> bracket's terrible default much clearer.

No, I understand you correctly. And It doesn't matter whether writes
were *successful* inside withFile but flushing buffers fails, or writes
failed themselves.


But I think it is time to stop. We can continue on reddit if you are
interested:
http://www.reddit.com/r/haskell/comments/2m6swm/making_bracket_uninterruptible_during_cleanup/

Thanks,
Yuras




More information about the Libraries mailing list