[Haskell-cafe] Printing of asynchronous exceptions to stderr

Simon Marlow marlowsd at gmail.com
Wed Dec 1 10:50:49 CET 2010

On 01/12/2010 03:02, Mitar wrote:
> Hi!
> On Thu, Nov 18, 2010 at 2:19 PM, Simon Marlow<marlowsd at gmail.com>  wrote:
>> then it isn't uninterruptible, because the timeout can interrupt it.  If you
>> can tolerate a timeout exception, then you can tolerate other kinds of async
>> exception too.
> Yes, but semantics are different. I want to tolerate some exception
> because they are saying I should do this and this (for example user
> interrupt, or timeout) but I do not want others, which somebody else
> maybe created and I do not want to care about them.

Surely if you don't care about these other exceptions, then the right 
thing to do is just to propagate them?  Why can't they be dealt with in 
the same way as user interrupt?

>> My main question is then, why do you want to use maskUninterruptible rather
>> than just mask?  Can you give a concrete example?
> I have written few of them. As I said: timeout and user exceptions.
> Timeout is for interrupts with which me as a programmer want to limit
> otherwise uninterruptible code, and user exceptions so that users can
> limit otherwise uninterruptible code.
> But in meanwhile I have find an elegant way to solve my problems (very
> old one in fact). ;-)
> I have defined such function:
> uninterruptible :: IO a ->  IO a
> uninterruptible a = *CENSORED*

That is a very scary function indeed.  It just discards all exceptions 
and re-starts the operation.  I definitely do not condone its use.


More information about the Glasgow-haskell-users mailing list