Contains operations for working with values of type Result.
Function or value | Description |
Full Usage:
bind binder result
Parameters:
'T -> Result<'U, 'TError>
-
A function that takes the value of type T from a result and transforms it into
a result containing a value of type U.
result : Result<'T, 'TError>
-
The input result.
Returns: Result<'U, 'TError>
A result of the output type of the binder.
|
Example
|
|
Example
|
|
Example
|
Full Usage:
defaultValue value result
Parameters:
'T
-
The specified default value.
result : Result<'T, 'Error>
-
The input result.
Returns: 'T
The result if the result is Ok, else the default value.
|
Example
|
Full Usage:
defaultWith defThunk result
Parameters:
'Error -> 'T
-
A thunk that provides a default value when evaluated.
result : Result<'T, 'Error>
-
The input result.
Returns: 'T
The result if the result is Ok, else the result of evaluating defThunk.
|
![]() ![]() ![]() ![]() ![]() ![]()
Gets the value of the result if the result is
defThunk is not evaluated unless result is
Example
|
Full Usage:
exists predicate result
Parameters:
'T -> bool
-
A function that evaluates to a boolean when given a value from the result type.
result : Result<'T, 'Error>
-
The input result.
Returns: bool
False if the result is Error, otherwise it returns the result of applying the predicate
to the result value.
|
Example
|
Full Usage:
fold folder state result
Parameters:
'State -> 'T -> 'State
-
A function to update the state data when given a value from an result.
state : 'State
-
The initial state.
result : Result<'T, 'Error>
-
The input result.
Returns: 'State
The original state if the result is Error, otherwise it returns the updated state with the folder
and the result value.
|
Example
|
Full Usage:
foldBack folder result state
Parameters:
'T -> 'State -> 'State
-
A function to update the state data when given a value from an result.
result : Result<'T, 'Error>
-
The input result.
state : 'State
-
The initial state.
Returns: 'State
The original state if the result is Error, otherwise it returns the updated state with the folder
and the result value.
|
Example
|
Full Usage:
forall predicate result
Parameters:
'T -> bool
-
A function that evaluates to a boolean when given a value from the result type.
result : Result<'T, 'Error>
-
The input result.
Returns: bool
True if the result is Error, otherwise it returns the result of applying the predicate
to the result value.
|
Example
|
|
Example
|
|
Example
|
|
Example
|
|
Example
|
|
Example
|
Full Usage:
toArray result
Parameters:
Result<'T, 'Error>
-
The input result.
Returns: 'T[]
The result array.
|
Example
|
|
Example
|
|
Example
|
Full Usage:
toValueOption result
Parameters:
Result<'T, 'Error>
-
The input result.
Returns: ValueOption<'T>
The result value.
|
Example
|