4 module Control.Exception,
9 import Prelude hiding (catch)
10 import Control.Exception
12 #if __GLASGOW_HASKELL__ < 609
13 type SomeException = Exception
15 onException :: IO a -> IO () -> IO a
16 onException io what = io `catch` \e -> do what
20 catchIO :: IO a -> (IOException -> IO a) -> IO a
21 #if __GLASGOW_HASKELL__ >= 609
24 catchIO io handler = io `catch` handler'
25 where handler' (IOException ioe) = handler ioe
29 handleIO :: (IOException -> IO a) -> IO a -> IO a
30 handleIO = flip catchIO
32 tryIO :: IO a -> IO (Either IOException a)
33 #if __GLASGOW_HASKELL__ >= 609
36 tryIO io = do ei <- try io
38 Right v -> return (Right v)
39 Left (IOException ioe) -> return (Left ioe)