[commit: base] master: Use fromException instead of cast when matching exceptions (23d7c26)
Simon Marlow
marlowsd at gmail.com
Thu Feb 14 11:49:09 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/23d7c26d57bb1f8d82acde15f224ff53bca766a9
>---------------------------------------------------------------
commit 23d7c26d57bb1f8d82acde15f224ff53bca766a9
Author: Simon Marlow <marlowsd at gmail.com>
Date: Thu Feb 7 09:00:22 2013 +0000
Use fromException instead of cast when matching exceptions
Since I added the SomeAsyncException class, we weren't calling the
StackOverflowHook() properly for stack overflows, because this bit of
code was not expecting the extra layer in the hierarchy.
>---------------------------------------------------------------
GHC/TopHandler.lhs | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/GHC/TopHandler.lhs b/GHC/TopHandler.lhs
index f1b0cbf..160b8d1 100644
--- a/GHC/TopHandler.lhs
+++ b/GHC/TopHandler.lhs
@@ -148,22 +148,22 @@ topHandlerFastExit err =
-- another error, etc.)
--
real_handler :: (Int -> IO a) -> SomeException -> IO a
-real_handler exit se@(SomeException exn) = do
+real_handler exit se = do
flushStdHandles -- before any error output
- case cast exn of
+ case fromException se of
Just StackOverflow -> do
reportStackOverflow
exit 2
Just UserInterrupt -> exitInterrupted
- _ -> case cast exn of
+ _ -> case fromException se of
-- only the main thread gets ExitException exceptions
Just ExitSuccess -> exit 0
Just (ExitFailure n) -> exit n
-- EPIPE errors received for stdout are ignored (#2699)
- _ -> case cast exn of
+ _ -> case fromException se of
Just IOError{ ioe_type = ResourceVanished,
ioe_errno = Just ioe,
ioe_handle = Just hdl }
More information about the ghc-commits
mailing list