
3 Nov
2008
3 Nov
'08
10:40 p.m.
On Mon, Nov 3, 2008 at 12:53 PM, Duncan Coutts
On Mon, 2008-11-03 at 09:26 -0800, Sigbjorn Finne wrote:
One way to do this now is to use Control.Exception.catches:
catches :: IO a -> [Handler a] -> IO a data Handler a where Handler :: forall a e. (Exception e) => (e -> IO a) -> Handler a
ie:
action `catches` [ \(e :: ExitCode) -> ... , \(e :: PatternMatchFail) -> ... ]
or just by using multiple catch clauses:
action `catch` (\(e :: ExitCode) -> ...) `catch` (\(e :: PatternMatchFail) -> ...)
I don't think those are equivalent. In the second case, the
PatternMatchFail handler scopes over the ExitCode handler.
--
Dave Menendez