
I have some exception types defined ... data POSTOnlyException = POSTOnlyException deriving ( Show, Typeable ) instance Exception POSTOnlyException data BadPathException = BadPathException deriving ( Show, Typeable ) instance Exception BadPathException ... and I want to use Data.Enumerator.catchError ... catchError :: Monad m => Iteratee a m b -> (SomeException -> Iteratee a m b) -> Iteratee a m b ... so I define an error handler ... handleErrors :: SomeException -> Iteratee a m String handleErrors ex = case fromException ex of Just POSTOnlyException -> return "POSTs only!" Just BadPathException -> return "Bad path!" _ -> return "Unknown exception!" ... but of course this doesn't compile, because the types of the LHSs in the case statement are different. I can get around it with some ugliness ... handleErrors :: SomeException -> Iteratee a m String handleErrors ex = case fromException ex of Just POSTOnlyException -> return "POSTs only!" _ -> case fromException ex of Just BadPathException -> return "Bad path!" _ -> return "Unknown exception!" ... but there must be a better way. Enlighten me? Cheers, Mike S Craig