Control.Exception

shelarcy shelarcy at gmail.com
Tue Nov 4 06:21:15 EST 2008


On Tue, 04 Nov 2008 19:41:58 +0900, Duncan Coutts <duncan.coutts at comlab.ox.ac.uk> wrote:
>> >> 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.
>>
>> I think Duncan forgot to write parens. According to Ian's example,
>> here is an equivalent code.
>>
>> (action
>>   `catch` (\(e :: ExitCode) -> ...))
>>   `catch` (\(e :: PatternMatchFail) -> ...)
>
> David is right. If the exit code handler throws a pattern match
> exception then the code behaves differently than the `catches` version.

I see. I misunderstood the problem.

Thanks,

-- 
shelarcy <shelarcy    hotmail.co.jp>
http://page.freett.com/shelarcy/


More information about the Glasgow-haskell-users mailing list