[Haskell-cafe] Use unsafePerformIO to catch Exception?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Mar 25 21:40:14 EDT 2009


On Wed, 2009-03-25 at 18:14 +0100, Benja Fallenstein wrote:
> On Wed, Mar 25, 2009 at 3:52 AM, Duncan Coutts

> > Of course your tryArith only tests for certain kinds of _|_ value, but
> > in principle the problem is the same.
> 
> That's not *quite* how the semantics of Haskell exceptions are
> defined, actually, unless I'm misunderstanding something or the
> thinking about it has changed since the original paper on the topic:

Yep, that's the semantics I've been working from too.

I was not being precise when I said "tests for _|_". As you point out,
the semantics of imprecise exceptions distinguishes exceptions from
bottom, however pure code cannot make that distinction and so that's why
I was lumping them together and saying that tryArith tests for certain
kinds of _|_ value.

> tryArith is still noncontinuous, though, and nondeterministic, too. Consider:

Those are nice examples. Thanks for that. I was too tired to come up
with any :-)

Anyway, I hope this is enough to dissuade people from using
unsafePerformIO to catch exceptions.

Duncan



More information about the Haskell-Cafe mailing list