
3 Nov
2008
3 Nov
'08
12:26 p.m.
On 11/3/2008 07:34, Jason Dagit wrote:
....
Ah, but I had one more question that I don't think anyone has answered yet. That is, how to deal with multiple types of exceptions. Suppose, as a concrete example, that I was looking out for both ExitCode and PatternMatchFail exceptions. Maybe I'm being naive, but it seems like I'm in that situation again where I have to catch all and then check if fromException succeeds on either PatternMatchFile or ExitCode types. And then throw if it both give Nothing?
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 --sigbjorn