ofChoice

Last updated 3 months ago

Result.ofChoice

Transforms F#'s Choice value to Result.

Namespace: FsToolkit.ErrorHandling

Function Signature:

Choice<'a,'b> -> Result<'a, 'b>

Examples:

Example 1

Result.ofChoice (Choice1Of2 42) // returns - Ok 42
Result.ofChoice (Choice2Of2 "Something went wrong!")
// returns - Error "Something went wrong!"