ofChoice

Namespace: FsToolkit.ErrorHandling

Transforms a Choice<'T, 'Error> into a Async<Result<'T, 'Error list>>

Function Signature

Choice<'T, 'Error> -> Async<Result<'T, 'Error list>>

Examples

Example 1

let result = AsyncValidation.ofChoice (Choice1Of2 42)
// async { return Ok 42 }

Example 2

let result = AsyncValidation.ofChoice (Choice2Of2 "error")
// async { return Error ["error"] }

Last updated