From 1523de9c11a0663e538f00679f6a4a682295b2de Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Fri, 24 Sep 2010 22:13:40 +0000 Subject: [PATCH] Replaced some throws to throwIOs where the type is IO --- Control/Exception/Base.hs | 8 ++++---- GHC/IO.hs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Control/Exception/Base.hs b/Control/Exception/Base.hs index 8ea4bf4..fb4f6de 100644 --- a/Control/Exception/Base.hs +++ b/Control/Exception/Base.hs @@ -426,7 +426,7 @@ catchJust -> IO a catchJust p a handler = catch a handler' where handler' e = case p e of - Nothing -> throw e + Nothing -> throwIO e Just b -> handler b -- | A version of 'catch' with the arguments swapped around; useful in @@ -452,7 +452,7 @@ handleJust p = flip (catchJust p) mapException :: (Exception e1, Exception e2) => (e1 -> e2) -> a -> a mapException f v = unsafePerformIO (catch (evaluate v) - (\x -> throw (f x))) + (\x -> throwIO (f x))) ----------------------------------------------------------------------------- -- 'try' and variations. @@ -482,14 +482,14 @@ tryJust p a = do case r of Right v -> return (Right v) Left e -> case p e of - Nothing -> throw e + Nothing -> throwIO e Just b -> return (Left b) -- | 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 - throw (e :: SomeException) + throwIO (e :: SomeException) ----------------------------------------------------------------------------- -- Some Useful Functions diff --git a/GHC/IO.hs b/GHC/IO.hs index c57abdc..d5272ba 100644 --- a/GHC/IO.hs +++ b/GHC/IO.hs @@ -254,7 +254,7 @@ catchException :: Exception e => IO a -> (e -> IO a) -> IO a catchException (IO io) handler = IO $ catch# io handler' where handler' e = case fromException e of Just e' -> unIO (handler e') - Nothing -> raise# e + Nothing -> raiseIO# e catchAny :: IO a -> (forall e . Exception e => e -> IO a) -> IO a catchAny (IO io) handler = IO $ catch# io handler' @@ -344,7 +344,7 @@ blocked = fmap (/= Unmasked) getMaskingState onException :: IO a -> IO b -> IO a onException io what = io `catchException` \e -> do _ <- what - throw (e :: SomeException) + throwIO (e :: SomeException) -- | Executes an IO computation with asynchronous -- exceptions /masked/. That is, any thread which attempts to raise -- 1.7.10.4