[Haskell-cafe] Exception handling when using STUArray

Henning Thielemann lemming at henning-thielemann.de
Wed Mar 12 07:40:05 EDT 2008

On Tue, 11 Mar 2008, Donn Cave wrote:

> On Mar 10, 2008, at 5:48 PM, Jonathan Cast wrote:
>> On 10 Mar 2008, at 12:37 AM, Donn Cave wrote:
> ...
>>> An exception is, for me, any state that isn't properly accounted for in 
>>> its
>>> immediate context.  openFile could return 'Maybe Handle', but it doesn't,
>>> so the context demands a Handle or an exception.
>> In the context of this discussion, `Maybe Handle' /is/ an exception type, 
>> because Maybe is an exception monad.  As is IO.  This distinction is one 
>> between an unusual-but-anticipated code path, and a case the programmer 
>> simply didn't handle at all.  The former is an exception; the latter is an 
>> error.

Thanks for that summary!

> I am not sure I understand what you're saying.  `Error' may be open
> to interpretation, but `exception' has a fairly unambiguous technical
> meaning in Haskell, a non-local flow of control with associated data
> type in Control.Exception.

The TRY construct for Maybe is called 'maybe', the exception handler is 
the first argument to 'maybe'. The absence of 'Maybe' after calling 
'maybe' shows that the exception was handled.

More information about the Haskell-Cafe mailing list