raising exceptions for signals

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Feb 15 15:35:25 EST 2007

>> btw, how about using for *Haskell* code *default* signal handler that
>> raise Haskell exception? i think that using signal handlers to process
>> OS-generated events is just legacy from the C days. i.e. 'main'
>> should be called by RTS inside code like this:
>>   mainThread <- myThreadId
>>   let onBreak event = do
>>         throwTo mainThread BreakException
>>   bracket (installHandler$ Catch onBreak) (installHandler) $  \oldHandler -> do
>>     main
>> (of course, this handles only ^Break and only on Windows)
>> among other things, this should make signal handling portable between
>> Win/Unix

> Yes, we've discussed this in the past (e.g. there was a thread about this on the
> haskell-prime list).  I'm definitely in favour of doing something along these lines.

how about adding such facility to ghc HEAD? i can write initial
windows implementation and put it to discussion here or in ghc

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Libraries mailing list