Mini-Prolog interpreter & ^C

Alastair Reid reid@cs.utah.edu
Mon, 12 Mar 2001 14:58:56 -0700


> The "readme" file of the mini-Prolog interpreter says:
>   Unfortunately, typing a control C to interrupt a query with an infinite loop
>   will exit the Prolog interpreter completely -- sorry, but I don't know a way
>   around this at the moment.
>
> -- A way to implement this, it seems me, is to design Hugs so that a ^C
> generates a Haskell exception; an unhandled exception should then cause an
> interrupt.

The readme you quote is fairly old.

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.

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.  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.

--
Alastair Reid