From 46c5f39fd76730ab5381243096b22399dafcc8ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 01:22:03 +0000 Subject: [PATCH 1/2] refactor: simplify splitAt 'rest' taskSeq to use while! The 'rest' sequence returned by splitAt used a manual go2 flag and an explicit MoveNextAsync pre-advance before its loop. This is equivalent to a direct 'while! e.MoveNextAsync() do yield e.Current' guarded by the existing 'go' flag (which tracks whether the source was exhausted while filling 'first'). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- release-notes.txt | 1 + src/FSharp.Control.TaskSeq/TaskSeqInternal.fs | 16 +++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/release-notes.txt b/release-notes.txt index 20ee8fb..ebaa6cc 100644 --- a/release-notes.txt +++ b/release-notes.txt @@ -2,6 +2,7 @@ Release notes: Unreleased + - refactor: simplify splitAt 'rest' taskSeq to use while!, removing redundant go2 mutable and manual MoveNextAsync pre-advance 1.1.1 - perf: use while! in groupBy, countBy, partition, except, exceptOfSeq to eliminate redundant mutable 'go' variables and initial MoveNextAsync calls diff --git a/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs b/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs index b935e13..7e73fb4 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs +++ b/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs @@ -848,18 +848,12 @@ module internal TaskSeqInternal = else go <- false - // 'rest' captures 'e' from the outer task block, following the same pattern as tryTail. + // 'rest' captures 'e' from the outer task block; if the source was not exhausted, + // advance once past the last element added to 'first', then yield the remainder. let rest = taskSeq { - let mutable go2 = go - - if go2 then - let! step = e.MoveNextAsync() - go2 <- step - - while go2 do - yield e.Current - let! step = e.MoveNextAsync() - go2 <- step + if go then + while! e.MoveNextAsync() do + yield e.Current } return first.ToArray(), rest From 12069f25e1c4cfc362f030a5da716b402bd05fb7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 18 Apr 2026 01:22:05 +0000 Subject: [PATCH 2/2] ci: trigger checks