Skip to content

[Repo Assist] Add AsyncSeq.exists2, exists2Async, forall2, forall2Async#322

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-forall2-exists2-20260429-5fd2d38a847baee0
Draft

[Repo Assist] Add AsyncSeq.exists2, exists2Async, forall2, forall2Async#322
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-forall2-exists2-20260429-5fd2d38a847baee0

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Adds four new combinators to fill F# collection API parity gaps:

Function Description Mirrors
AsyncSeq.exists2 Tests whether any corresponding pair satisfies a synchronous predicate Seq.exists2
AsyncSeq.exists2Async Async-predicate variant of exists2
AsyncSeq.forall2 Tests whether all corresponding pairs satisfy a synchronous predicate Seq.forall2
AsyncSeq.forall2Async Async-predicate variant of forall2

Motivation

exists2 and forall2 are natural companions to the existing exists/forall and zip/zip3 family. Developers familiar with Seq.exists2 / Seq.forall2 will naturally look for these in AsyncSeq.

Semantics

Both functions evaluate pairwise up to the shorter of the two sequences, consistent with Seq.exists2 / Seq.forall2:

  • exists2: returns true as soon as a matching pair is found; returns false if no pair matches
  • forall2: returns false as soon as a failing pair is found; returns true if all checked pairs pass (including the degenerate empty case)

Both short-circuit — exists2 stops at the first true result, forall2 stops at the first false.

Implementation Details

  • Direct enumerator loop (same pattern as compareWithAsync) — no intermediate allocations
  • exists2 / forall2 are thin synchronous wrappers delegating to the Async variants
  • .fsi signature file updated with XML doc comments
  • RELEASE_NOTES.md updated under new 4.17.0 entry

Test Status

Build: 0 errors, 12 pre-existing warnings only
Tests: 434/434 passed (12 new tests covering: match/no-match, empty sequences, short-circuit behaviour, shorter-sequence termination, and async-predicate variants for both exists2 and forall2)

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

Adds four new API functions mirroring Seq.exists2 / Seq.forall2:

- AsyncSeq.exists2: tests whether any pairwise pair satisfies
  a synchronous predicate (short-circuits on first match)
- AsyncSeq.exists2Async: async-predicate variant of exists2
- AsyncSeq.forall2: tests whether all pairwise pairs satisfy
  a synchronous predicate (short-circuits on first failure)
- AsyncSeq.forall2Async: async-predicate variant of forall2

All four evaluate pairwise up to the shorter of the two sequences,
consistent with Seq.exists2 / Seq.forall2 semantics.

12 tests added; 434/434 pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants