Final bikeshedding call: Fixing Control.Exception.bracket
John Lato
jwlato at gmail.com
Thu Nov 13 18:27:52 UTC 2014
On 07:16, Thu, Nov 13, 2014 Yuras Shumovich <shumovichy at gmail.com> wrote:
On Thu, 2014-11-13 at 15:51 +0200, Eyal Lotem wrote:
> On Thu, Nov 13, 2014 at 1:21 PM, Yuras Shumovich <shumovichy at gmail.com>
> wrote:
> > You probably have some special requirements, but that code is bad in
> > general case. It doesn't guaranty anything because the process may never
> > exit. Here you probably should try to terminate it (and close standard
> > streams if any) and then wait for it. (Unless the process is short
> > living *and* doesn't communicate with parent.)
> >
>
> That is true - and indeed my code does actually have a terminateProcess
> <
https://github.com/ElastiLotem/buildsome/blob/master/src/Lib/Process.hs#L21-L32
>
> in there right before waiting for the process (and more stuff too).
Hmm, at the first glance, the code looks overengineered. I wonder
whether it is correct even under uninterruptibleMask. I may miss the
point though, but I'm not surprised you had hard times with it.
I think auditing code to see if it should be refactored to avoid this
problem is fruitful. Functions like bracket should "just work", so they can
be used reliably even by novice programmers. Currently that's not the case.
Your objection seems to be that users should know how to write reliable
handlers. While that's certainly true, I think we should make it as easy as
possible to do so. Deep knowledge of async exceptions is IMHO just plain
excessive.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141113/bc90aa2d/attachment.html>
More information about the Libraries
mailing list