Exceptions vs. Errors (Re: Readline read_history and write_history addition)

Simon Marlow simonmarhaskell at gmail.com
Wed Jan 23 08:53:47 EST 2008

Henning Thielemann wrote:

> You know, in Haskell we do not need a built-in exception handling facility
> because we can handle it with the elements of the language. Returning an
> exceptional value or throwing an exception is the same. We can only hide
> the exception propagation by appropriate binding of actions.

I don't consider exceptions in the IO monad to be a "built-in" concept. 
This is because, if we wanted to, we could implement IO exceptions purely 
in Haskell on top of a primitive IO monad without exceptions (indeed, 
that's what Hugs and other systems do, and what GHC did in the past).  If 
you are implementing a Haskell system, you don't need to provide any 
primitive functionality to support exceptions, it can all be done in the 
implementation of the IO monad.  Exceptions are no more built-in than the 
Either type.

In practice, you might want to implement exceptions at a lower level for 
performance reasons, which is what GHC does.


More information about the Libraries mailing list