Generalizing Network.CGI exceptions to MonadCatchIO

Bas van Dijk v.dijk.bas at
Mon Mar 15 16:33:59 EDT 2010

On Mon, Mar 15, 2010 at 8:37 PM, Anders Kaseorg <andersk at> wrote:
> (It would be possible to generalize the types even further, from
> SomeException to Exception e => e, but I’m worried about introducing
> ambiguous type variables into existing code.  After this patch, new code
> can just use the Control.Monad.CatchIO functions directly to deal with
> Exception e => e.)

(Note I'm not a user of the cgi package so don't take the following to

What about deprecating all the cgi exception handling functions:
throwCGI, catchCGI and tryCGI in favor of the CatchIO ones?

The advantage: a simpler API.

The disadvantage: possible ambiguous type variables like you
mentioned. However, these can usually be resolved using a simple type
annotation in your exception handler. Maybe somebody can analyze the
reverse dependencies of cgi to see if any ambiguities will actually



It would also be a good idea to rename the section "Error handling" to
"Exception handling" because of:

More information about the Libraries mailing list