Issues with new Control.Exception

John Goerzen jgoerzen at
Wed Jan 28 16:00:35 EST 2009

Hi everyone,

Please CC me on replies as I'm not on this list.

I've noticed several issues with Control.Exception, although I'm not
sure I'm equipped well to fix them:

 * onException is undocumented

 * Catch doesn't work in many common cases anymore.  In particular,
   the example right there in haddock is broken:

      catch (openFile f ReadMode)
       (\e -> hPutStr stderr ("Couldn't open "++f++": " ++ show e))

   That's broken, of course, because the type of e isn't fixed.
   But it's also broken because openFile has a different return type
   than hPutStr.

 * The catchJust example references errorCalls, which is no longer in

 * I like the new system overall, but it is annoying that
   we can't do the sort of catch that is contemplated in the example
   above anymore.  This is especially annoying for me in several cases
   where I want to catch *any* exception and do things with it,
   especially when doing unit testing.

 * I wonder if the docs to Control.Exception could benefit from a
   review.  I also notice that the comments about catchJust may no
   longer apply.

 * What is the expected life expectancy of OldException, and how does
   it interact with Exception?  Can I use catch from OldException to
   still do what I want?  If so, it might be nice to note how exactly
   catch works with new exceptions.

Some of these I may be able to submit patches for in time, but right
now I'm mainly trying to understand what the expected way to use the
new exceptions is, so I'm probably not the right person to do it yet.

-- John

More information about the Libraries mailing list