stdlib - 0.11.0

Stdlib.Data.Result.Base

Definitions

type Result Error ValueSource#

The Result type represents either a success with a value of `ok` or an error with value `error`.

Constructors

| error Error
| ok Value

open Result using {error; ok} public

handleResult {Error Value1 Value2} (onError : Error -> Value2) (onOk : Value1 -> Value2) (result : Result Error Value1) : Value2Source#

Apply the onError function if the value is error or apply the onOk function if the value is ok.

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.

isError {Error Value} (result : Result Error Value) : BoolSource#

Return true if the value is an error, otherwise false.

isOk {Error Value} (result : Result Error Value) : BoolSource#

Return true if the value is ok, otherwise false.