:: String -> Maybe Int -package:unliftio

Read a positive Int, accounting for overflow
Parse seed argument
>>> parseSeed "--seed=6"
Just 6

>>> parseSeed "--seeeed=6"
Nothing
Parse number of threads argument
>>> parseThreads "-j6"
Just 6

>>> parseThreads "-j-2"
Nothing

>>> parseThreads "-jA"
Nothing
Returns the operator precedence of an infix string.
> outernmostPrec "1 + 2"
Just 6
Lookup a terminal capability that has an integer value
Convert to an Int.
throws ExpectFailed. This is nice for writing your own abstractions.
Lifted version of die.
>>> die "Goodbye!"
Goodbye!
*** Exception: ExitFailure 1
Lifted version of die. die is available since base-4.8, but it's more convenient to redefine it instead of using CPP.
When you encounter an error where the only sane way to handle it is to write an error to the log and die messily, use fatalError. This is a good candidate for things like not being able to find configuration files on startup.
General-purpose function to throw a test exception with a String.
Throws a Pending exception with a message to add additional details.
Just like expectationFailure, but does not force the return type to unit. Lifted version of assertFailure
Fail with a message. This operation is not part of the mathematical definition of a monad, but is invoked on pattern-match failure in a do expression. As part of the MonadFail proposal (MFP), this function is moved to its own class MonadFail (see Control.Monad.Fail for more details). The definition here will be removed in a future release.
The type-safe cast operation
Cast a value to a different type. Essentially this is just a drop-in replacement for cast.
Throw an error, escaping the current computation up to the nearest catchError (if any).
runThrow (throwError e >>= k) = runThrow (throwError e)
Like throwEnvelopeErr but without providing a message.
>>> import Control.Monad.Except (runExcept)

>>> throwEnvelopeErr "BAD_ERROR" "a very bad error occurred!" :: Either (Err String) Int
Left (Err {errErr = "BAD_ERROR", errExtra = Just "a very bad error occurred!"})