mapOk : (a -> b) -> Result e a -> Result e b
Transform the success value, leaving an Error untouched. mapOk f (Ok x) = Ok (f x) ; mapOk f (Error e) = Error e
import nécessaire.mapOk : (a -> b) -> Result e a -> Result e bmapError : (e -> f) -> Result e a -> Result f aandThen : (a -> Result e b) -> Result e a -> Result e bresult : (e -> c) -> (a -> c) -> Result e a -> cwithDefault : a -> Result e a -> aisOk : Result e a -> BoolisError : Result e a -> BooltoMaybe : Result e a -> Maybe aokOr : e -> Maybe a -> Result e amapOk : (a -> b) -> Result e a -> Result e b
Transform the success value, leaving an Error untouched. mapOk f (Ok x) = Ok (f x) ; mapOk f (Error e) = Error e
mapError : (e -> f) -> Result e a -> Result f a
Transform the error value, leaving an Ok untouched.
andThen : (a -> Result e b) -> Result e a -> Result e b
Chain a fallible computation: run f on the success value, short-circuit on the first Error. This is monadic bind for Result e. xs |> andThen f reads left-to-right.
result : (e -> c) -> (a -> c) -> Result e a -> c
Eliminate a Result: provide a handler for each side (error first). result onError onOk r collapses r to a single value.
withDefault : a -> Result e a -> a
The success value, or a default if it was an Error.
isOk : Result e a -> Bool
True if the Result is Ok.
isError : Result e a -> Bool
True if the Result is Error.
toMaybe : Result e a -> Maybe a
Forget the error, keeping just the optional success value.
okOr : e -> Maybe a -> Result e a
Turn an optional value into a Result, using e as the error for Nothing.