projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6af7e08
)
Add onException
author
Ian Lynagh
<igloo@earth.li>
Wed, 30 Jul 2008 17:20:14 +0000
(17:20 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Wed, 30 Jul 2008 17:20:14 +0000
(17:20 +0000)
Control/Exception.hs
patch
|
blob
|
history
diff --git
a/Control/Exception.hs
b/Control/Exception.hs
index
cd71313
..
d3a88e8
100644
(file)
--- a/
Control/Exception.hs
+++ b/
Control/Exception.hs
@@
-76,6
+76,7
@@
module Control.Exception (
try, -- :: IO a -> IO (Either Exception a)
tryJust, -- :: (Exception -> Maybe b) -> a -> IO (Either b a)
ignoreExceptions,
try, -- :: IO a -> IO (Either Exception a)
tryJust, -- :: (Exception -> Maybe b) -> a -> IO (Either b a)
ignoreExceptions,
+ onException,
-- ** The @evaluate@ function
evaluate, -- :: a -> IO a
-- ** The @evaluate@ function
evaluate, -- :: a -> IO a
@@
-348,6
+349,10
@@
tryJust p a = do
ignoreExceptions :: IO () -> IO ()
ignoreExceptions io = io `catchAny` \_ -> return ()
ignoreExceptions :: IO () -> IO ()
ignoreExceptions io = io `catchAny` \_ -> return ()
+onException :: IO a -> IO () -> IO a
+onException io what = io `catch` \e -> do what
+ throw (e :: SomeException)
+
-----------------------------------------------------------------------------
-- Some Useful Functions
-----------------------------------------------------------------------------
-- Some Useful Functions