Definitions
type Result Error ValueSource#
The Result type represents either a success with a value of `ok` or an error with value `error`.
handleResult {Error Value1 Value2} (onError : Error -> Value2) (onOk : Value1 -> Value2) (result : Result Error Value1) : Value2Source#
mapError {Value Error1 Error2} (fun : Error1 -> Error2) (result : Result Error1 Value) : Result Error2 ValueSource#
Apply a function f to the error value of a Result.
mapOk {Error Value1 Value2} (fun : Value1 -> Value2) (result : Result Error Value1) : Result Error Value2Source#
Apply a function f to the ok value of a Result.
fromError {Error Value} (defaultError : Error) (result : Result Error Value) : ErrorSource#
Return the contents of an error value, otherwise return defaultError.
fromOk {Error Value} (defaultValue : Value) (result : Result Error Value) : ValueSource#
Return the contents of an ok value, otherwise return defaultValue.
resultToMaybe {Error Value} (result : Result Error Value) : Maybe ValueSource#
Convert a Result to a Maybe. An error value becomes `nothing`.
maybeToResult {Error Value} (defaultError : Error) (maybeValue : Maybe Value) : Result Error ValueSource#
Convert a Maybe to a Result. A nothing value becomes `error defaultError`.