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 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.
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
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.
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.