Hugs wish-list item:

> > What's the appropriate forum for this? I can make up a suggested mapping 
> > if it's helpful. But I know little about Haskell. Does ghc have some
> > mapping already in place?
> 
> It must do since they have an implementation - just a question of
> finding the (unpublished) docs (or the source).
> 
> Or, we can wait for the great Hugs-GHC library merger to happen and 
> Hugs automatically inherits GHC's mapping.

OK, the relevant info is in the following files in the GHC distro:

ghc/lib/std/PrelIOBase.lhs has a function constructErrorMsg which
calls C functions getErrType__ and getErrStr__ to get the error code
and error string.  It then converts the error type to an IOError.  For
example, ERR_RESOURCEEXHAUSTED goes to ResourceExhausted.

ghc/lib/std/cbits/errno.c is where these functions live.  They simply
read ghc_errtype and ghc_errstr, respectively.

In errno.c, the errno global is converted to ghc_errno by cvtErrno().
This contains mappings like E2BIG -> GHC_E2BIG .  Next, stdErrno()
converts ghc_errno to ghc_errtype and ghc_errstr.  For example,
GHC_E2BIG goes to ERR_RESOURCEEXHAUSTED and "argument list too long".

Do we agree that this is a reasonable spec for the Hugs mapping?

HTH.

--KW 8-)

Reply via email to