From d228bd53cd39c71b7d8ae41d3401a2d2032c6624 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 13:54:02 +0000 Subject: [PATCH 1/2] Initial plan From 613940e682aa9e74c9c330a59864eb6d0f869671 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 13:58:51 +0000 Subject: [PATCH 2/2] Add YieldFrom overload for seq<'T> in asyncSeq computation expression Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com> --- src/FSharp.Control.AsyncSeq/AsyncSeq.fs | 3 +++ src/FSharp.Control.AsyncSeq/AsyncSeq.fsi | 3 +++ .../AsyncSeqTests.fs | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/FSharp.Control.AsyncSeq/AsyncSeq.fs b/src/FSharp.Control.AsyncSeq/AsyncSeq.fs index 47d91fa..cdf7349 100644 --- a/src/FSharp.Control.AsyncSeq/AsyncSeq.fs +++ b/src/FSharp.Control.AsyncSeq/AsyncSeq.fs @@ -868,6 +868,9 @@ module AsyncSeq = member x.For (seq:AsyncSeq<'T>, action:'T -> AsyncSeq<'TResult>) = collect action seq + member x.YieldFrom (s:seq<'T>) = + ofSeq s + let unfoldAsync (f:'State -> Async<('T * 'State) option>) (s:'State) : AsyncSeq<'T> = new UnfoldAsyncEnumerator<_, _>(f, s) :> _ diff --git a/src/FSharp.Control.AsyncSeq/AsyncSeq.fsi b/src/FSharp.Control.AsyncSeq/AsyncSeq.fsi index 2d3309a..9635bc3 100644 --- a/src/FSharp.Control.AsyncSeq/AsyncSeq.fsi +++ b/src/FSharp.Control.AsyncSeq/AsyncSeq.fsi @@ -112,6 +112,9 @@ module AsyncSeq = /// Implements "yield!" for the asyncSeq computation builder. member YieldFrom : source:AsyncSeq<'T> -> AsyncSeq<'T> + /// Implements "yield!" for a synchronous sequence in the asyncSeq computation builder. + member YieldFrom : source:seq<'T> -> AsyncSeq<'T> + /// Implements empty for the asyncSeq computation builder. member Zero : unit -> AsyncSeq<'T> diff --git a/tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs b/tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs index e13a842..5dffd6f 100644 --- a/tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs +++ b/tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs @@ -156,6 +156,26 @@ let ``AsyncSeq.toListSynchronously``() = Assert.True(([1;2;3] = a)) +[] +let ``asyncSeq yield! seq works``() = + let items = seq { 1; 2; 3 } + let s = asyncSeq { + yield! items + } + let a = s |> AsyncSeq.toListSynchronously + Assert.True(([1;2;3] = a)) + +[] +let ``asyncSeq yield! seq combines with other yields``() = + let items = seq { 2; 3 } + let s = asyncSeq { + yield 1 + yield! items + yield 4 + } + let a = s |> AsyncSeq.toListSynchronously + Assert.True(([1;2;3;4] = a)) + [] let ``AsyncSeq.concatSeq works``() = let ls = [ [1;2] ; [3;4] ]