Additional operations on Choice
Function or value | Description |
|
Applies the wrapped value to the wrapped function when both are Choice1Of2 and returns a wrapped result or the first Choice2Of2.
This is as if Choice1Of2 respresents a Success value and Choice2Of2 a Failure.
The function wrapped in a Choice1Of2 or a Choice2Of2.
The value wrapped in a Choice1Of2 or a Choice2Of2.
|
|
|
|
|
Full Usage:
Choice.bind binder source
Parameters:
'T -> Choice<'U, 'T2>
-
A function that takes the value of type T and transforms it into a Choice containing (potentially) a value of type U.
source : Choice<'T, 'T2>
-
The source input value.
Returns: Choice<'U, 'T2>
A result of the output type of the binder.
|
|
Full Usage:
Choice.bindChoice2Of2 binder source
Parameters:
'T2 -> Choice<'T, 'U2>
-
A function that takes the value of type T and transforms it into a Choice containing (potentially) a value of type U.
source : Choice<'T, 'T2>
-
The source input value.
Returns: Choice<'T, 'U2>
A result of the output type of the binder.
|
|
|
|
Full Usage:
Choice.either fChoice1Of2 fChoice2Of2 source
Parameters:
'a -> 'b
-
Function to be applied to source, if it contains a Choice1Of2 value.
fChoice2Of2 : 'c -> 'b
-
Function to be applied to source, if it contains a Choice2Of2 value.
source : Choice<'a, 'c>
-
The source value, containing a Choice1Of2 or a Choice2Of2.
Returns: 'b
The result of applying either functions.
Modifiers: inline Type parameters: 'a, 'b, 'c |
|
|
|
Full Usage:
Choice.map mapping source
Parameters:
'T -> 'U
-
A function to apply to the Choice1Of2 value.
source : Choice<'T, 'T2>
-
The source input value.
Returns: Choice<'U, 'T2>
A Choice1Of2 of the input value after applying the mapping function, or the original Choice2Of2 value if the input is Choice2Of2.
|
|
|
|
Full Usage:
Choice.map3 mapping x y z
Parameters:
'T -> 'U -> 'V -> 'W
-
A function to apply to the Choice1Of2 values.
x : Choice<'T, 'Error>
-
The first Choice value.
y : Choice<'U, 'Error>
-
The second Choice value.
z : Choice<'V, 'Error>
-
The third Choice value.
Returns: Choice<'W, 'Error>
The combined value, or the first Choice2Of2.
|
|
|
|
|
|
|