Simon & I have discussed some changes to various names in GHC's exception
support, details below, comments appreciated.


Problems:

* IOErrors are currently distinct from Exceptions.  You can't catch
  an exception with IO.catch or throw one with IO.ioError.

* the most commonly used exception catching function, namely
  catchAllIO, has the longest name.

* raiseInThread is a horrible name.


Proposal:

* type IOError = Exception.

* Rename the current IOError type to IOException, and make the
  appropriate change to the Exception data type.

* New catch family (in module Exception):

  catch     :: IO a -> (Exception -> IO a) -> IO a
  catchJust :: (Exception -> Maybe b) -> IO a -> (b -> IO a) -> IO a

  evaluate :: a -> IO a
  evaluate a = a `seq` return a

  ioExceptions    :: Exception -> Maybe IOError
  arithExceptions :: Exception -> Maybe ArithException
  etc.

  (and similarly for the 'try' family).

  so eg.
                catchAll expr (\ex -> ...)
  is now
                catch (evaluate expr) (\err -> ...)


* Rename raiseInThread to throwTo.

Cheers,
        SImon

Reply via email to