[Haskell-cafe] Problem with a sample from RWH

C K Kashyap ckkashyap at gmail.com
Thu Sep 30 03:35:04 EDT 2010


> The change looks good; note, however, that you're doing something
> subtly different if an error occurs: in the original, if an error
> occured then "fail" was used to forcibly terminate the program.  Your
> variant however returns the shown error message.  Depending on the
> situation, this is usually a bad thing (better off to use Maybe or
> Either).
>
> Also, here's the official rationale about why SomeException is not
> recommended: http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Control-Exception.html#4
> .  My main summation of this is that it even catches when you try to
> use Ctrl-c to kill a program.
>
I tried this - this is consistent with the original in terms of the
exiting out ... but the error message does not show up.

run s = handle (\e@(SomeException{}) -> exitWith (ExitFailure 1)) $ do

How can I achieve both?


-- 
Regards,
Kashyap


More information about the Haskell-Cafe mailing list