Exceptions with Hugs 98
Alastair Reid
alastair@reid-consulting-uk.ltd.uk
19 Sep 2002 21:34:07 +0100
juan albornoz <jalborno@escuelaing.edu.co> writes:
> Hello I need to catch some exceptions which I've "thrown" with the
> error function. I am using WinHugs 98. Can any one help me?
Something along the lines of:
import qualified Exception as E
foo = E.catch <mumble> (\e -> print e)
should do you.
See the papers on exception handling:
http://www.reid-consulting-uk.ltd.uk/alastair/publications/except-pldi.ps.gz
and the documentation for the library
http://www.haskell.org/ghc/docs/latest/html/base/Control.Exception.html
(This is GHC documentation but the Hugs library is mostly compatible.
The main differences are in things not covered by the original paper -
see the (quite readable) source code for the Hugs version of Exception
for details.)
--
Alastair Reid alastair@reid-consulting-uk.ltd.uk
Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/