ofChoice

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)
// Ok 42
‚Äč
Result.ofChoice (Choice2Of2 "Something went wrong!")
// Error "Something went wrong!"