blackholes and exception handling
Ian Lynagh
igloo at earth.li
Sun May 2 06:31:44 EDT 2010
On Sun, May 02, 2010 at 12:10:23AM +0200, Sebastian Fischer wrote:
>
> although, don't_launch_first is a non-terminating computation. Without
> black-hole detection this code would never 'launch missiles'.
>
> Is the above output intended?
Yes.
> go_ahead :: SomeException -> IO ()
> go_ahead _ = putStr "go ahead, "
Note that catching all exceptions is rarely the right thing to do. See
http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Control-Exception.html#4
for more details.
> The idea behind black-hole detection is that one bottom is as good as
> another [1]. Consequently, exception handling may not distinguish
> between non-termination and other errors.
Pure code can't distinguish, but exception handling code in IO can.
Thanks
Ian
More information about the Glasgow-haskell-users
mailing list