[Haskell-cafe] Help using catch in 6.10

John Meacham john at repetae.net
Sat Feb 21 18:59:04 EST 2009


On Sat, Feb 21, 2009 at 01:54:52PM +0000, Ian Lynagh wrote:
> On Sat, Feb 21, 2009 at 01:18:35AM +0100, Martijn van Steenbergen wrote:
> > 
> > You now need to specify the exact type of the exception you wish to 
> > catch. For example, to catch any exception:
> > 
> > action `catch` (\(e :: SomeException) -> handler)
> > 
> > For more information, see:
> > 
> > http://www.haskell.org/~simonmar/papers/ext-exceptions.pdf
> 
> See also
> 
> "Catching all exceptions"
> http://www.haskell.org/ghc/dist/stable/docs/libraries/base/Control-Exception.html#4

It is too bad we didn't name SomeException to just be Exception, then it
would be quite straightforward to write code that cleanly compiles on
6.8 and 6.10. As it is,

#if __GLASGOW_HASKELL__ < 610
type SomeException = Exception
#endif

does the trick, but no one likes CPP...

        John


-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-Cafe mailing list