proposed major change: Hugs and Exceptions

Ross Paterson ross@soi.city.ac.uk
Thu, 16 Jan 2003 17:26:28 +0000


Hugs has

	data Exception = IOException IOError | HugsException HugsException

where IOErrors are passed to a failure continuation and printed using
Show.  HugsExceptions are redexes that caused an error, triggering
a longjmp.  If not caught, they get printed by the internal printer,
e.g. {primDivInt 1 0}.

In my tree, I've switched over to the full Exception type (as in
Control.Exception), with all Exceptions triggering a longjmp, caught by
runAndShowError and printed using Show, e.g. "divide by zero" -- less
information, but more friendly.  Almost all of Control.Exception (all but
throwTo/throwDynTo) then works with Hugs.  The failure continuation in the
IO type is then unused, though it's still there for now.  A disadvantage
is that the Exception types and Show instances move into Hugs.Prelude.

It touches quite a few files, but it passes the test suite (appropriately
modified), and I'm thinking of committing it.  Anyone want to advise
caution?