ofChoice
Namespace: FsToolkit.ErrorHandling
Transforms a Choice<'T, 'Error>
into a CancellableTask<Result<'T, 'Error list>>
Function Signature
Choice<'T, 'Error> -> CancellableTask<Result<'T, 'Error list>>
Examples
Example 1
let result = CancellableTaskValidation.ofChoice (Choice1Of2 42)
// cancellableTask { return Ok 42 }
Example 2
let result = CancellableTaskValidation.ofChoice (Choice2Of2 "error")
// cancellableTask { return Error ["error"] }
Last updated