[Haskell-cafe] How to catch all exceptions that could be caught?

Gregory Crosswhite gcrosswhite at gmail.com
Thu Jan 12 07:34:54 CET 2012

On 01/12/12 13:03, Magicloud Magiclouds wrote:
> Hi,
>   With Prelude.catch, I could write "catch () $ \_ -> return Nothing".
> But with Control.Exception.catch, I must specify a type for the "_".
> What should I do?

Use SomeException for the type, as it is the base of the exception

(Although Haskell does not have classes in the OOP sense and therefore
does not have a built-in means of expressing subtype relations, it
emulates this in a somewhat awkward manner for exceptions.)


More information about the Haskell-Cafe mailing list