Description
Is your feature request related to a problem? Please describe.
The Option
module includes traverse
and sequence
operations for use with Async
(per #298), but not Task
. Since the prevailing wisdom for F# code going forward seems to be "prefer Task
", having these functions would encourage that choice.
Describe the solution you'd like
I'd like the following functions implemented in the Option
module:
// traverseTask: ('a -> Task<'b>) -> 'a option -> Task<'b option>
// sequenceTask: Task<'a> option -> Task<'a option>
Additionally, some other permutations that would be useful:
To match functions added in #321
// traverseTaskResult: ('a -> Task<Result<'b,'c>>) -> 'a option -> Task<Result<'b option, 'c>>
// sequenceTaskResult: Task<Result<'a, 'e>> option -> Task<Result<'a option>, 'e>
It could also be useful to have permutations that work with IcedTasks
, such as:
// traverseCancellableTaskResult: ('a -> CancellableTask<Result<'b,'c>>) -> 'a option -> CancellableTask<Result<'b option, 'c>>
// sequenceCancellableTaskResult: CancellableTask<Result<'a, 'e>> option -> CancellableTask<Result<'a option>, 'e>
Since there are a potentially large amount of possible permutations, I'm partial to breaking this into a few issues / PRs, but this at least gets the conversation started.
Describe alternatives you've considered
Custom extensions in each codebase that needs these functions