CError/IOError issues
Manuel M. T. Chakravarty
chak@cse.unsw.edu.au
Tue, 09 Jan 2001 13:24:23 +1100
qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) wrote,
> This mess should be cleared out. IMHO ghc should store the error
> description in IOException separately from the filename. Haskell98
> doesn't provide an interface to extract the location (function name
> where the error occurred) from an IOError, so it would be used only
> for showing the IOError. fail should use UserErrors, ioeGetErrorString
> and friends should understand UserErrors - or UserErrors should be
> put with other IOErrors again?
Sounds sensible to me.
> Perhaps CError should provide a function to build an IOError value
> (not throwing it) from the function name, errno number, Maybe Handle
> and Maybe FilePath. Plus throwErrno as a quick variant which takes the
> function name from the parameter, takes the errno number from the errno
> variable, sets other two components to Nothing and throws the error.
> throwCError would be gone.
I was wondering about that, too. But I wasn't sure whether
such functionality is really needed. However, it might be a
bit more inline with the interface provided by the IO monad,
where you have `userError' to build an `IOError' and
`ioError' to throw it. Opinions?
Cheers,
Manuel