ofResult

Namespace: FsToolkit.ErrorHandling

Transforms a Result<'T, 'Error> value to 'T Option.

Function Signature

Result<'T, 'Error> -> 'T Option

Examples

Example 1

let opt = Option.ofResult (Ok 1)
// Some 1

Example 2

let opt = Option.ofResult (Error "error")
// None

Last updated