X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FTopHandler.lhs;h=c983e34bd371cb82abac45b830bff4ec9b5216f4;hb=10de2c656f74562b662c22928be85e1b3ccda796;hp=8ff357a0c8a1e190636f35afbcc1ade7c4cefc1f;hpb=e825f8ddcec2739ab69d365b654523fd4e61ae17;p=ghc-base.git diff --git a/GHC/TopHandler.lhs b/GHC/TopHandler.lhs index 8ff357a..c983e34 100644 --- a/GHC/TopHandler.lhs +++ b/GHC/TopHandler.lhs @@ -27,7 +27,7 @@ import Prelude import System.IO import Control.Exception -import Foreign.C ( CInt ) +import Foreign.C ( CInt ) import GHC.IOBase import GHC.Exception import GHC.Prim (unsafeCoerce#) @@ -61,7 +61,7 @@ runIO main = catchException main topHandler -- runIOFastExit :: IO a -> IO a runIOFastExit main = catchException main topHandlerFastExit - -- NB. this is used by the testsuite driver + -- NB. this is used by the testsuite driver -- | The same as 'runIO', but for non-IO computations. Used for -- wrapping @foreign export@ and @foreign import \"wrapper\"@ when these @@ -85,18 +85,18 @@ real_handler :: (Int -> IO a) -> Exception -> IO a real_handler exit exn = cleanUp >> case exn of - AsyncException StackOverflow -> do - reportStackOverflow - exit 2 + AsyncException StackOverflow -> do + reportStackOverflow + exit 2 - -- only the main thread gets ExitException exceptions - ExitException ExitSuccess -> exit 0 - ExitException (ExitFailure n) -> exit n + -- only the main thread gets ExitException exceptions + ExitException ExitSuccess -> exit 0 + ExitException (ExitFailure n) -> exit n - other -> do - reportError other - exit 1 - + other -> do + reportError other + exit 1 + reportStackOverflow :: IO a reportStackOverflow = do callStackOverflowHook; return undefined @@ -110,7 +110,7 @@ reportError ex = do -- SUP: Are the hooks allowed to re-enter Haskell land? If so, remove -- the unsafe below. foreign import ccall unsafe "stackOverflow" - callStackOverflowHook :: IO () + callStackOverflowHook :: IO () -- try to flush stdout/stderr, but don't worry if we fail -- (these handles might have errors, and we don't want to go into