Add requireSomeWith and requireNoneWith for lazy error evaluation#352
Merged
TheAngryByrd merged 3 commits intomasterfrom Feb 25, 2026
Merged
Add requireSomeWith and requireNoneWith for lazy error evaluation#352TheAngryByrd merged 3 commits intomasterfrom
requireSomeWith and requireNoneWith for lazy error evaluation#352TheAngryByrd merged 3 commits intomasterfrom
Conversation
…t, TaskResult, and JobResult Co-authored-by: TheAngryByrd <1490044+TheAngryByrd@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add requireSomeWith helper for Result type
Add Feb 25, 2026
requireSomeWith and requireNoneWith for lazy error evaluation
TheAngryByrd
requested changes
Feb 25, 2026
Collaborator
TheAngryByrd
left a comment
There was a problem hiding this comment.
@copilot add or update gitbook documentation
Co-authored-by: TheAngryByrd <1490044+TheAngryByrd@users.noreply.github.com>
Contributor
Author
There was a problem hiding this comment.
Pull request overview
This PR adds lazy evaluation variants requireSomeWith and requireNoneWith to defer error construction until it's actually needed, providing performance benefits when error messages are expensive to compute.
Changes:
- Added
requireSomeWithandrequireNoneWithfunctions to Result, AsyncResult, TaskResult, and JobResult modules with[<InlineIfLambda>]for zero-cost abstraction - Added comprehensive test coverage for all implementations covering happy path and error path scenarios
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/FsToolkit.ErrorHandling/Result.fs | Core implementation with XML documentation for requireSomeWith and requireNoneWith functions |
| src/FsToolkit.ErrorHandling/AsyncResult.fs | Async wrapper delegating to Result module implementations |
| src/FsToolkit.ErrorHandling/TaskResult.fs | Task wrapper delegating to Result module implementations |
| src/FsToolkit.ErrorHandling.JobResult/JobResult.fs | Job wrapper delegating to Result module implementations |
| tests/FsToolkit.ErrorHandling.Tests/Result.fs | Test coverage for Result module with happy/error path tests and integration into test suite |
| tests/FsToolkit.ErrorHandling.Tests/AsyncResult.fs | Test coverage for AsyncResult module with async test cases and integration |
| tests/FsToolkit.ErrorHandling.Tests/TaskResult.fs | Test coverage for TaskResult module with task test cases and integration |
| tests/FsToolkit.ErrorHandling.JobResult.Tests/JobResult.fs | Test coverage for JobResult module with proper [<Tests>] attributes and integration |
TheAngryByrd
added a commit
that referenced
this pull request
Feb 27, 2026
- [Add IAsyncEnumerable support to task computation expressions](#347) Credits @Copilot - [Add `valueTaskValueOption` CE for `ValueTask<'T voption>` computation expressions](#348) Credits @Copilot - [Add `cancellableValueTaskOption` and `cancellableValueTaskResult` CEs for IcedTasks](#349) Credits @Copilot - [Add `Source` overloads to `taskResultOption` CE for interop with `Result`, `TaskResult`, `Option`, `Task`, and `Async`](#351) Credits @Copilot - [Add `requireSomeWith` and `requireNoneWith` for lazy error evaluation](#352) Credits @Copilot - [Add `TaskResult.ofCatchTask`](#353) Credits @Copilot - [Add comprehensive gitbook documentation for all public API surface](#354) Credits @Copilot
TheAngryByrd
added a commit
that referenced
this pull request
Feb 27, 2026
- [Add IAsyncEnumerable support to task computation expressions](#347) Credits @Copilot - [Add `valueTaskValueOption` CE for `ValueTask<'T voption>` computation expressions](#348) Credits @Copilot - [Add `cancellableValueTaskOption` and `cancellableValueTaskResult` CEs for IcedTasks](#349) Credits @Copilot - [Add `Source` overloads to `taskResultOption` CE for interop with `Result`, `TaskResult`, `Option`, `Task`, and `Async`](#351) Credits @Copilot - [Add `requireSomeWith` and `requireNoneWith` for lazy error evaluation](#352) Credits @Copilot - [Add `TaskResult.ofCatchTask`](#353) Credits @Copilot - [Add comprehensive gitbook documentation for all public API surface](#354) Credits @Copilot
TheAngryByrd
added a commit
that referenced
this pull request
Feb 27, 2026
- [Add IAsyncEnumerable support to task computation expressions](#347) Credits @Copilot - [Add `valueTaskValueOption` CE for `ValueTask<'T voption>` computation expressions](#348) Credits @Copilot - [Add `cancellableValueTaskOption` and `cancellableValueTaskResult` CEs for IcedTasks](#349) Credits @Copilot - [Add `Source` overloads to `taskResultOption` CE for interop with `Result`, `TaskResult`, `Option`, `Task`, and `Async`](#351) Credits @Copilot - [Add `requireSomeWith` and `requireNoneWith` for lazy error evaluation](#352) Credits @Copilot - [Add `TaskResult.ofCatchTask`](#353) Credits @Copilot - [Add comprehensive gitbook documentation for all public API surface](#354) Credits @Copilot Remove AutoGPT subproject reference
TheAngryByrd
added a commit
that referenced
this pull request
Feb 27, 2026
- [Add IAsyncEnumerable support to task computation expressions](#347) Credits @Copilot - [Add `valueTaskValueOption` CE for `ValueTask<'T voption>` computation expressions](#348) Credits @Copilot - [Add `cancellableValueTaskOption` and `cancellableValueTaskResult` CEs for IcedTasks](#349) Credits @Copilot - [Add `Source` overloads to `taskResultOption` CE for interop with `Result`, `TaskResult`, `Option`, `Task`, and `Async`](#351) Credits @Copilot - [Add `requireSomeWith` and `requireNoneWith` for lazy error evaluation](#352) Credits @Copilot - [Add `TaskResult.ofCatchTask`](#353) Credits @Copilot - [Add comprehensive gitbook documentation for all public API surface](#354) Credits @Copilot Remove AutoGPT subproject reference
TheAngryByrd
added a commit
that referenced
this pull request
Feb 27, 2026
- [Add IAsyncEnumerable support to task computation expressions](#347) Credits @Copilot - [Add `valueTaskValueOption` CE for `ValueTask<'T voption>` computation expressions](#348) Credits @Copilot - [Add `cancellableValueTaskOption` and `cancellableValueTaskResult` CEs for IcedTasks](#349) Credits @Copilot - [Add `Source` overloads to `taskResultOption` CE for interop with `Result`, `TaskResult`, `Option`, `Task`, and `Async`](#351) Credits @Copilot - [Add `requireSomeWith` and `requireNoneWith` for lazy error evaluation](#352) Credits @Copilot - [Add `TaskResult.ofCatchTask`](#353) Credits @Copilot - [Add comprehensive gitbook documentation for all public API surface](#354) Credits @Copilot
TheAngryByrd
added a commit
that referenced
this pull request
Feb 27, 2026
- [Add IAsyncEnumerable support to task computation expressions](#347) Credits @Copilot - [Add `valueTaskValueOption` CE for `ValueTask<'T voption>` computation expressions](#348) Credits @Copilot - [Add `cancellableValueTaskOption` and `cancellableValueTaskResult` CEs for IcedTasks](#349) Credits @Copilot - [Add `Source` overloads to `taskResultOption` CE for interop with `Result`, `TaskResult`, `Option`, `Task`, and `Async`](#351) Credits @Copilot - [Add `requireSomeWith` and `requireNoneWith` for lazy error evaluation](#352) Credits @Copilot - [Add `TaskResult.ofCatchTask`](#353) Credits @Copilot - [Add comprehensive gitbook documentation for all public API surface](#354) Credits @Copilot Remove AutoGPT subproject reference
This was referenced Mar 2, 2026
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.
requireSomeWithandrequireNoneWithtoResult.fsrequireSomeWithandrequireNoneWithtoAsyncResult.fsrequireSomeWithandrequireNoneWithtoTaskResult.fsrequireSomeWithandrequireNoneWithtoJobResult.fs(JobResult project)result/requireFunctions.mdasyncResult/others.mdtaskResult/others.mdjobResult/others.mdOriginal prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.