ErrorSourceerror is a type used to represent potentially failing computations. Success * marks a successful completion of a computation, whilst Fail err marks a failure, * with err as the reason.
return is the monadic lifting function for error, representing a successful * computation.
fail err represents a failing computation, with error message err.
(>>=) is the monadic binding function for error.
as_maybe e drops an error value into a maybe value, throwing away * error information.
repeatM count action fails if action is a failing computation, or * successfully produces a list count elements long, where each element is * the value successfully returned by action.
repeatM' count seed action is a variant of repeatM that acts like repeatM * apart from any successful result returns a tuple whose second component is seed * and whose first component is the same as would be returned by repeatM.
mapM f xs maps f across xs, failing if f fails on any element of xs.
foldM f e xs performs a monadic right fold of f across xs using e * as the base case. Fails if any application of f fails.
string_of_error err produces a string representation of err.