Repository navigation
Option.traverseAsync and traverseTask now allow mapping to new types - #335
Merged
TheAngryByrd merged 3 commits intoJul 12, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates Option.traverseTask and Option.traverseAsync to allow mapping from 'T to a different output type 'U, and adds tests to verify the new behavior.
- Changed signatures of
traverseTaskandtraverseAsyncto accept functions returningTask<'U>/Async<'U>and to returnTask<Option<'U>>/Async<Option<'U>>. - Added tests in
Option.fsto confirm mapping to new types for bothtraverseTaskandtraverseAsync.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/FsToolkit.ErrorHandling/Option.fs | Updated traverseTask and traverseAsync signatures and return types to use generic 'U. |
| tests/FsToolkit.ErrorHandling.Tests/Option.fs | Added test cases ensuring traverseTask and traverseAsync correctly map to new types. |
Comments suppressed due to low confidence (2)
src/FsToolkit.ErrorHandling/Option.fs:343
- Update the
<returns>XML doc comment to reflect the new return type<c>Task<'U option></c>instead of<c>Task<'T option></c>.
///
src/FsToolkit.ErrorHandling/Option.fs:410
- Clarify the
<returns>XML doc comment fortraverseAsyncto specify<c>Async<Option<'U>></c>to match the updated signature.
/// <returns>An Async Option with the mapped value.</returns>
TheAngryByrd
added a commit
that referenced
this pull request
Jul 12, 2025
- Fix [Option.traverseAsync and traverseTask now allow mapping to new types](#335) (Credits PaigeM89!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Fixes #334
Types of changes
What types of changes does your code introduce to FsToolkit.ErrorHandling?
Put an
xin the boxes that apply and remove ones that don't applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
I only found one other case that needed updating, but it's possible more are lurking somewhere.