Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 416 Bytes

File metadata and controls

27 lines (18 loc) · 416 Bytes

Validation.ofChoice

Namespace: FsToolkit.ErrorHandling

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

Function Signature

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

Examples

Example 1

let result = Validation.ofChoice (Choice1Of2 42)
// Ok 42

Example 2

let result = Validation.ofChoice (Choice2Of2 "error")
// Error ["error"]