blackholes and exception handling
sebf at informatik.uni-kiel.de
Sun May 2 07:10:17 EDT 2010
>> Is the above output intended?
> Note that catching all exceptions is rarely the right thing to do. See
> for more details.
I should have written
go_ahead :: NonTermination -> IO ()
in the first place.
>> The idea behind black-hole detection is that one bottom is as good as
>> another . Consequently, exception handling may not distinguish
>> between non-termination and other errors.
> Pure code can't distinguish, but exception handling code in IO can.
What makes me wary is that GHC distinguishes between different kinds
of non-terminating computations (those it can detect as black holes
and those it can't). As a consequence, the semantics of my program
depends on how I define the infinite loop don't_launch_first (the
program either writes to stdout or doesn't).
For me, it is interesting to notice (and slightly disturbing) that
this is intended and that the Control.Exception module defines the
NonTermination exception to explicitly handle black holes.
Thank you for clarifying!
Underestimating the novelty of the future is a time-honored tradition.
More information about the Glasgow-haskell-users