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

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Thu Jan 12 07:49:57 CET 2012


On 12 January 2012 17:34, Gregory Crosswhite <gcrosswhite at gmail.com> wrote:
> 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
> hierarchy.

But it is usually recommended that you *don't* do this, as it even
captures Ctrl-c invocations:
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html#g:4

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com



More information about the Haskell-Cafe mailing list