blackholes and exception handling
Felipe Lessa
felipe.lessa at gmail.com
Sun May 2 08:32:03 EDT 2010
On Sun, May 02, 2010 at 01:10:17PM +0200, Sebastian Fischer wrote:
> 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.
If you think about it, there aren't a lot of options:
(a) Don't provide a way of catching *any* kind of
non-terminating computations.
(b) Provide a way to catch some of them.
(c) Solve the halting problem and catch'em all. =)
Considering that someone who wants (a) can live with (b) or (c)
just by ignoring the extra functionality, and that (c) is
impossible, GHC provides (b).
Cheers,
--
Felipe.
More information about the Glasgow-haskell-users
mailing list