X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FException%2FBase.hs;h=06c53900c141d6c6bc5d5f5bceffbf423e84a77d;hb=82b61ac8e14df43f84afc20c6f6691f433f07951;hp=b803b5eaaba56cd0ddacb77a7794cc8afe1b461a;hpb=c856e1e71c608e8c291218f66645eb748270b6d2;p=ghc-base.git diff --git a/Control/Exception/Base.hs b/Control/Exception/Base.hs index b803b5e..06c5390 100644 --- a/Control/Exception/Base.hs +++ b/Control/Exception/Base.hs @@ -106,10 +106,11 @@ module Control.Exception.Base ( #ifdef __GLASGOW_HASKELL__ import GHC.Base -import GHC.IOBase +import GHC.IO hiding (finally,onException) +import GHC.IO.Exception +import GHC.Exception import GHC.Show -import GHC.IOBase -import GHC.Exception hiding ( Exception ) +-- import GHC.Exception hiding ( Exception ) import GHC.Conc #endif @@ -382,7 +383,7 @@ catch :: Exception e -> (e -> IO a) -- ^ Handler to invoke if an exception is raised -> IO a #if __GLASGOW_HASKELL__ -catch = GHC.IOBase.catchException +catch = GHC.IO.catchException #elif __HUGS__ catch m h = Hugs.Exception.catchException m h' where h' e = case fromException e of @@ -473,7 +474,7 @@ tryJust p a = do -- | Like 'finally', but only performs the final action if there was an -- exception raised by the computation. onException :: IO a -> IO b -> IO a -onException io what = io `catch` \e -> do what +onException io what = io `catch` \e -> do _ <- what throw (e :: SomeException) ----------------------------------------------------------------------------- @@ -508,7 +509,7 @@ bracket before after thing = block (do a <- before r <- unblock (thing a) `onException` after a - after a + _ <- after a return r ) #endif @@ -523,7 +524,7 @@ finally :: IO a -- ^ computation to run first a `finally` sequel = block (do r <- unblock a `onException` sequel - sequel + _ <- sequel return r )