Mini-Prolog interpreter & ^C

Hans Aberg haberg@matematik.su.se
Tue, 13 Mar 2001 10:50:00 +0100


At 14:58 -0700 2001/03/12, Alastair Reid wrote:
>The readme you quote is fairly old.

By computer standards, very, very old, something like 1996. Do you remember
what did you do in 1996? :-)

>GHC provides exactly the kind of exception handling you want.
>Look for mention of asynchronous exceptions in their documentation and/or
>read the paper about asynchronous exceptions on Simon
>Peyton Jones home page.

Yes, I know that Haskell should support exceptions. On the other hand, I
may attempt to translate the mini-Prolog Haskell code into C++ for learning
purposes, so then I do not need it... :-)

>Hugs provides a more limited form of exception handling which lets you
>catch some exceptions but not others.  Unfortunately the
>mechanism is not well documented, makes it hard to generate good error
>messages and interacts badly with the recently improved
>concurrency implementation in Hugs.  I don't remember if ctrl-C is on the
>list of exceptions it can catch.

The reason that I mention it, is that I recall that ^C on Hugs just causes
a regular interrupt signal and not an exception.

The implementation of ^C as an Haskell exception would probably require
first to pick up this signal (as it is usually hardwired to the console),
and then rethrow it as a Haskell exception. Then the Hugs evaluation
mechanism would take the Haskell program down when it encounters an
unhandled exception, mention that it was an interrupt exception that was
not handled.

>  Fixing these
>deficiencies would be one way of fixing the current problems using the HGL
>(http://haskell.org/graphics) with the recent Hugs
>release.  It remains to be seen whether I go down that path.

If one writes an entirely new console interface, then one can of course let
^C directly generate a Haskell exception.

  Hans Aberg