The type of a result. A result is either Ok x carrying the normal return value x or is Bad e carrying some indication of an error. The value associated with a bad result is usually an exception (exn) that can be raised.
Execute a function and catch any exception as a result. This function encapsulates code that could throw an exception and returns that exception as a value.
This monad is very similar to the option monad, but instead of being None when an error occurs, the first error in the sequence is preserved as the return value.