3 Nov 23:40
Re: Control.Exception
David Menendez <dave <at> zednenem.com>
2008-11-03 22:40:50 GMT
2008-11-03 22:40:50 GMT
On Mon, Nov 3, 2008 at 12:53 PM, Duncan Coutts <duncan.coutts <at> worc.ox.ac.uk> wrote: > 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 <dave <at> zednenem.com> <http://www.eyrie.org/~zednenem/>
RSS Feed