sequenceVOptionM
Namespace: FsToolkit.ErrorHandling
Applies the monadic function id
to each element in the input list, and returns the result as an option. If any element in the list is ValueNone, the entire result will be ValueNone.
Function Signature
'a voption list -> 'a list voption
Examples
Example 1
let myList =
[
ValueSome 123
ValueSome 456
ValueSome 789
]
List.sequenceVOptionM myList
// ValueSome [123; 456; 789]
Example 2
let myList =
[
ValueSome 123
ValueNone
ValueSome 789
]
List.sequenceVOptionM myList
// ValueNone
Last updated