| |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
Synopsis | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
Documentation | |||||||||||||||||||||||||||||||||||||||||||||||
data GhcException | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
showGhcException :: GhcException -> String -> String | |||||||||||||||||||||||||||||||||||||||||||||||
throwGhcException :: GhcException -> a | |||||||||||||||||||||||||||||||||||||||||||||||
handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a | |||||||||||||||||||||||||||||||||||||||||||||||
ghcError :: GhcException -> a | |||||||||||||||||||||||||||||||||||||||||||||||
progName :: String | |||||||||||||||||||||||||||||||||||||||||||||||
pgmError :: String -> a | |||||||||||||||||||||||||||||||||||||||||||||||
panic :: String -> a | |||||||||||||||||||||||||||||||||||||||||||||||
panicFastInt :: String -> FastInt | |||||||||||||||||||||||||||||||||||||||||||||||
assertPanic :: String -> Int -> a | |||||||||||||||||||||||||||||||||||||||||||||||
trace :: String -> a -> a | |||||||||||||||||||||||||||||||||||||||||||||||
When called, trace outputs the string in its first argument, before returning the second argument as its result. The trace function is not referentially transparent, and should only be used for debugging, or for monitoring execution. Some implementations of trace may decorate the string that's output to indicate that you're tracing. The function is implemented on top of putTraceMsg. | |||||||||||||||||||||||||||||||||||||||||||||||
class (Typeable e, Show e) => Exception e where | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
showException :: Exception e => e -> String | |||||||||||||||||||||||||||||||||||||||||||||||
try :: Exception e => IO a -> IO (Either e a) | |||||||||||||||||||||||||||||||||||||||||||||||
Similar to catch, but returns an Either result which is (Right a) if no exception of type e was raised, or (Left ex) if an exception of type e was raised and its value is ex. If any other type of exception is raised than it will be propogated up to the next enclosing exception handler. try a = catch (Right `liftM` a) (return . Left)Note that System.IO.Error also exports a function called System.IO.Error.try with a similar type to Control.Exception.try, except that it catches only the IO and user families of exceptions (as required by the Haskell 98 IO module). | |||||||||||||||||||||||||||||||||||||||||||||||
tryMost :: IO a -> IO (Either SomeException a) | |||||||||||||||||||||||||||||||||||||||||||||||
tryMost is like try, but passes through Interrupted and Panic exceptions. Used when we want soft failures when reading interface files, for example. | |||||||||||||||||||||||||||||||||||||||||||||||
throwTo :: Exception e => ThreadId -> e -> IO () | |||||||||||||||||||||||||||||||||||||||||||||||
throwTo raises an arbitrary exception in the target thread (GHC only). throwTo does not return until the exception has been raised in the target thread. The calling thread can thus be certain that the target thread has received the exception. This is a useful property to know when dealing with race conditions: eg. if there are two threads that can kill each other, it is guaranteed that only one of the threads will get to kill the other. If the target thread is currently making a foreign call, then the exception will not be raised (and hence throwTo will not return) until the call has completed. This is the case regardless of whether the call is inside a block or not. Important note: the behaviour of throwTo differs from that described in the paper "Asynchronous exceptions in Haskell" (http://research.microsoft.com/~simonpj/Papers/asynch-exns.htm). In the paper, throwTo is non-blocking; but the library implementation adopts a more synchronous design in which throwTo does not return until the exception is received by the target thread. The trade-off is discussed in Section 9 of the paper. Like any blocking operation, throwTo is therefore interruptible (see Section 5.3 of the paper). There is currently no guarantee that the exception delivered by throwTo will be delivered at the first possible opportunity. In particular, a thread may unblock and then re-block exceptions (using unblock and block) without receiving a pending throwTo. This is arguably undesirable behaviour. | |||||||||||||||||||||||||||||||||||||||||||||||
installSignalHandlers :: IO () | |||||||||||||||||||||||||||||||||||||||||||||||
interruptTargetThread :: MVar [ThreadId] | |||||||||||||||||||||||||||||||||||||||||||||||
Produced by Haddock version 2.6.0 |