try package:ghc-lib-parser
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)
`tryEtaReduce [x,y,z] e sd` returns `Just e'` if `x y z -> e` is
evaluated according to sd and can soundly and gainfully be
eta-reduced to e'. See Note [Eta reduction soundness] and
Note [Eta reduction makes sense] when that is the case.
Try performing an
IO action, failing on error.
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 pass through UserInterrupt and Panic exceptions. Used
when we want soft failures when reading interface files, for example.
TODO: I'm not entirely sure if this is catching what we really want to
catch
Try not to default type variables of the kinds
RuntimeRepLevityMultiplicity.
Note that these might get defaulted anyway, if they are kind variables
and `-XNoPolyKinds` is enabled.