Skip to content

[Auto Maintainer Assistant] [co-maintainer] Allow AsyncSeq.mergeAll to accept seq instead of list #218

Closed

Description

@github-actions

🤖 This PR was created by the repository's automated AI maintenance assistant.

Closes #165

Root cause

AsyncSeq.mergeAll previously required a list argument. Since F# lists, arrays, and other collections all implement seq, accepting seq(AsyncSeq<'T)> makes the function more ergonomic — in particular, users can pass the result of Async.Parallel (which returns an array) without an explicit conversion.

Change

  • .fsi: Changed parameter type from AsyncSeq<'T> list to seq(AsyncSeq<'T)>
  • .fs: Changed parameter type to match; added let ss = List.ofSeq ss to materialise the sequence before use (the implementation needs .Length and indexed access)

Backward compatibility

list implements seq, so all existing call sites continue to compile without changes.

Test Status

  • Debug build passes (dotnet build -c Debug)
  • Release build passes (dotnet build -c Release)
  • Debug tests pass (dotnet test -c Debug) — 182 passed, 0 failed
  • Release tests pass (dotnet test -c Release) — 182 passed, 0 failed

Generated by Auto Maintainer Assistant


Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download patch artifact

The patch file is available in the agent-artifacts artifact in the workflow run linked above.

To apply the patch locally:

# Download the artifact from the workflow run https://github.com/fsprojects/FSharp.Control.AsyncSeq/actions/runs/22231625810
# (Use GitHub MCP tools if gh CLI is not available)
gh run download 22231625810 -n agent-artifacts

# The patch file will be at agent-artifacts/tmp/gh-aw/aw.patch after download
# Apply the patch
git am agent-artifacts/tmp/gh-aw/aw.patch
Show patch preview (50 of 50 lines)
From 65a9fec49da5bd075e5e6560305e3bfef0691a33 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 20 Feb 2026 16:20:58 +0000
Subject: [PATCH] feat: change AsyncSeq.mergeAll to accept seq instead of list

This makes mergeAll more flexible by accepting any sequence type
(list, array, seq, etc.), which is backward compatible since list
implements seq.

Closes #165

Co-authored-by: Copilot <[email protected]>
---
 src/FSharp.Control.AsyncSeq/AsyncSeq.fs  | 3 ++-
 src/FSharp.Control.AsyncSeq/AsyncSeq.fsi | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/FSharp.Control.AsyncSeq/AsyncSeq.fs b/src/FSharp.Control.AsyncSeq/AsyncSeq.fs
index f749ea7..bfcbb83 100644
--- a/src/FSharp.Control.AsyncSeq/AsyncSeq.fs
+++ b/src/FSharp.Control.AsyncSeq/AsyncSeq.fs
@@ -1700,8 +1700,9 @@ member x.Dispose() =
 
   /// Merges all specified async sequences into an async sequence non-deterministically.
   // By moving the last emitted task to the end of the array, this algorithm achieves max-min fairness when merging AsyncSeqs
-  let mergeAll (ss:AsyncSeq<'T> list) : AsyncSeq<'T> =
+  let mergeAll (ss:seq<AsyncSeq<'T>>) : AsyncSeq<'T> =
     asyncSeq {
+      let ss = List.ofSeq ss
       let n = ss.Length
 
       let moveToEnd i (a: 'a[]) =
diff --git a/src/FSharp.Control.AsyncSeq/AsyncSeq.fsi b/src/FSharp.Control.AsyncSeq/AsyncSeq.fsi
index 15c1bf5..e0ad0c1 100644
--- a/src/FSharp.Control.AsyncSeq/AsyncSeq.fsi
+++ b/src/FSharp.Control.AsyncSeq/AsyncSeq.fsi
@@ -502,7 +502,8 @@ inherit IDisposable
 
     /// Merges all specified async sequences into an async sequence non-deterministically.
     /// The resulting async sequence produces elements when any argument sequence produces an element.
-    val mergeAll : sources:AsyncSeq<'T> list -> AsyncSeq<'T>
+    /// Accepts any sequence type (list, array, seq, etc.).
+    val mergeAll : sources:seq<AsyncSeq<'T>> -> AsyncSeq<'T>
     #end
... (truncated)

Activity

  1. dsyme commented on Feb 20, 2026

    @dsyme
    Contributor

    Closing as the PR was not successfully created and I'd like this to be retried when we update GH AW tooling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions