X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Futils%2FPanic.lhs;h=4f78aabc24b16b2746d5becc2079ca6e74366e96;hp=e6c385c7d20620f46c5e4acedd699918175f2c48;hb=9d0c8f842e35dde3d570580cf62a32779f66a6de;hpb=1f3a7730cd7f831344d2a3b74a0ce700c382e858 diff --git a/compiler/utils/Panic.lhs b/compiler/utils/Panic.lhs index e6c385c..4f78aab 100644 --- a/compiler/utils/Panic.lhs +++ b/compiler/utils/Panic.lhs @@ -17,7 +17,7 @@ module Panic panic, panicFastInt, assertPanic, trace, - Exception.Exception(..), showException, try, tryMost, tryUser, throwTo, + Exception.Exception(..), showException, try, tryMost, throwTo, installSignalHandlers, interruptTargetThread ) where @@ -40,7 +40,6 @@ import Control.Concurrent ( MVar, ThreadId, withMVar, newMVar ) import Data.Dynamic import Debug.Trace ( trace ) import System.IO.Unsafe ( unsafePerformIO ) -import System.IO.Error hiding ( try ) import System.Exit import System.Environment \end{code} @@ -171,21 +170,6 @@ tryMost action = do r <- try action -- Anything else is rethrown Nothing -> throwIO se Right v -> return (Right v) - --- | tryUser is like try, but catches only UserErrors. --- These are the ones that are thrown by the TcRn monad --- to signal an error in the program being compiled -tryUser :: IO a -> IO (Either IOException a) -tryUser io = - do ei <- try io - case ei of - Right v -> return (Right v) - Left se -> - case fromException se of - Just ioe - | isUserError ioe -> - return (Left ioe) - _ -> throw se \end{code} Standard signal handlers for catching ^C, which just throw an @@ -206,8 +190,8 @@ installSignalHandlers = do (thread:_) -> throwTo thread interrupt_exn -- #if !defined(mingw32_HOST_OS) - installHandler sigQUIT (Catch interrupt) Nothing - installHandler sigINT (Catch interrupt) Nothing + _ <- installHandler sigQUIT (Catch interrupt) Nothing + _ <- installHandler sigINT (Catch interrupt) Nothing return () #else -- GHC 6.3+ has support for console events on Windows