Other Functions
isOk
Returns true
if the value is Ok, otherwise returns false
.
Function Signature
Result<_> -> bool
isError
Returns true
if the value is Error, otherwise returns false
.
Function Signature
Result<_> -> bool
sequenceAsync
Converts a Result<Async<'a>, 'b>
to Async<Result<'a, 'b>>
.
Function Signature
Result<Async<'a>, 'b> -> Async<Result<'a, 'b>>
traverseAsync
Converts a Result<'a, 'error>
to Async<Result<'b, 'error>>
by applying the given function to the Ok value.
Function Signature
('okInput -> Async<'okOutput>) -> Result<'okInput, 'error>
-> Async<Result<'okOutput, 'error>>
setError
Replaces an error value with a custom error value
Function Signature
'a -> Result<'b, 'c> -> Result<'b, 'a>
withError
Replaces a unit error value with a custom error value. Safer than setError
since you're not losing any information.
Function Signature
'a -> Result<'b, unit> -> Result<'b, 'a>
defaultValue
Returns the contained value if Ok, otherwise returns the provided value
Function Signature
'a -> Result<'a, 'b> -> 'a
defaultError
Returns the contained value if Error, otherwise returns the provided value
Function Signature
'b -> Result<'a, 'b> -> 'b
defaultWith
Returns the contained value if Ok, otherwise evaluates the given function and returns the result.
Function Signature
(unit -> 'a) -> Result<'a, 'b> -> 'a
valueOr
Returns the Ok value or runs the specified function over the error value.
Function Signature
('b -> 'a) -> Result<'a, 'b> -> 'a
ignore
Ignores the value of the input result and returns unit instead
Function Signature
Result<'ok, 'error> -> Result<unit, 'error>
ignoreError
Same as defaultValue
for a result where the Ok value is unit. The name describes better what is actually happening in this case.
Function Signature
Result<unit, 'a> -> unit
Last updated