try package:base

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 then it will be propagated up to the next enclosing exception handler.
try a = catch (Right `liftM` a) (return . Left)
A non-blocking version of putMVar. The tryPutMVar function attempts to put the value a into the MVar, returning True if it was successful, or False otherwise.
A non-blocking version of readMVar. The tryReadMVar function returns immediately, with Nothing if the MVar was empty, or Just a if the MVar was full with contents a.
A non-blocking version of takeMVar. The tryTakeMVar function returns immediately, with Nothing if the MVar was empty, or Just a if the MVar was full with contents a. After tryTakeMVar, the MVar is left empty.
A variant of try that takes an exception predicate to select which exceptions are caught (c.f. catchJust). If the exception does not match the predicate, it is re-thrown.
Like try but also returns the exception context, which is useful if you intend to rethrow the exception later.
The construct tryIOError comp exposes IO errors which occur within a computation, and which are not fully handled. Non-I/O exceptions are not caught by this variant; to catch all exceptions, use try from Control.Exception.
Throw an IOError corresponding to the current value of getErrno if the IO action returns a result of -1, but retries in case of an interrupted operation.
as throwErrnoIfMinus1Retry, but checks for operations that would block.
as throwErrnoIfMinus1RetryMayBlock, but discards the result.
as throwErrnoIfMinus1, but discards the result.
Throw an IOError corresponding to the current value of getErrno if the IO action returns nullPtr, but retry in case of an interrupted operation.
as throwErrnoIfNullRetry, but checks for operations that would block.
as throwErrnoIf, but retry the IO action when it yields the error code eINTR - this amounts to the standard retry loop for interrupted POSIX system calls.
as throwErrnoIfRetry, but additionally if the operation yields the error code eAGAIN or eWOULDBLOCK, an alternative action is executed before retrying.
as throwErrnoIfRetryMayBlock, but discards the result.
as throwErrnoIfRetry, but discards the result.
Retry execution of the current memory transaction because it has seen values in TVars which mean that it should not continue (e.g. the TVars represent a shared buffer that is now empty). The implementation may block the thread until one of the TVars that it has read from has been updated. (GHC only)
Non-blocking version of hLock. Returns True if taking the lock was successful and False otherwise.
Representation for the source location where a return frame was pushed on the stack. This happens every time when a case ... of scrutinee is evaluated.