Skip to content

Conversation

PaigeM89
Copy link
Contributor

Proposed Changes

Fixes #334

Types of changes

What types of changes does your code introduce to FsToolkit.ErrorHandling?
Put an x in the boxes that apply and remove ones that don't apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in 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.

  • Build and tests pass locally
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Further comments

I only found one other case that needed updating, but it's possible more are lurking somewhere.

@TheAngryByrd TheAngryByrd requested a review from Copilot July 12, 2025 17:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 traverseTask and traverseAsync to accept functions returning Task<'U> / Async<'U> and to return Task<Option<'U>> / Async<Option<'U>>.
  • Added tests in Option.fs to confirm mapping to new types for both traverseTask and traverseAsync.

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 for traverseAsync to specify <c>Async<Option<'U>></c> to match the updated signature.
    /// <returns>An Async Option with the mapped value.</returns>

Copy link
Collaborator

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@TheAngryByrd TheAngryByrd merged commit 05e35ed into demystifyfp:master Jul 12, 2025
26 checks passed
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!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relax types in traverseAsync etc.
2 participants