Conversation
Implements the remaining Group 1 functions identified in the AsyncSeq/TaskSeq design-parity gap analysis: - TaskSeq.replicateInfinite: infinite sequence of a constant value - TaskSeq.replicateInfiniteAsync: infinite sequence via repeated async computation - TaskSeq.replicateUntilNoneAsync: sequence until computation returns None - TaskSeq.firstOrDefault / lastOrDefault: convenience wrappers over tryHead/tryLast - TaskSeq.splitAt: split into prefix array + remaining TaskSeq in a single pass - TaskSeq.zipWith / zipWithAsync: zip two sequences with an inline mapping function - TaskSeq.zipWith3 / zipWithAsync3: zip three sequences with an inline mapping - TaskSeq.chunkBy / chunkByAsync: group consecutive elements by key - TaskSeq.threadState / threadStateAsync: streaming stateful map (like mapFold but yields lazily instead of materialising to an array) The distinctUntilChangedWith/Async pair was already added in PR #346. Includes 326 new tests and passes all 4942 existing tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dsyme
approved these changes
Mar 17, 2026
This was referenced Mar 17, 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.
🤖 This PR was created by Repo Assist, an automated AI assistant, at the request of @dsyme.
Summary
This PR implements the "Group 1" pure sequence operations identified in the AsyncSeq/TaskSeq design-parity gap analysis on issue #345, excluding
distinctUntilChangedWith/distinctUntilChangedWithAsync(already in PR #346).New functions added
replicateInfinite'T -> TaskSeq<'T>replicateInfiniteAsync(unit -> #Task<'T>) -> TaskSeq<'T>replicateUntilNoneAsync(unit -> #Task<'T option>) -> TaskSeq<'T>NonefirstOrDefault'T -> ('T -> bool) -> TaskSeq<'T> -> Task<'T>lastOrDefault'T -> ('T -> bool) -> TaskSeq<'T> -> Task<'T>splitAtint -> TaskSeq<'T> -> Task<'T[] * TaskSeq<'T>>zipWith('T -> 'U -> 'V) -> TaskSeq<'T> -> TaskSeq<'U> -> TaskSeq<'V>zipWithAsync('T -> 'U -> #Task<'V>) -> TaskSeq<'T> -> TaskSeq<'U> -> TaskSeq<'V>zipWithzipWith3('T -> 'U -> 'V -> 'W) -> TaskSeq<'T> -> TaskSeq<'U> -> TaskSeq<'V> -> TaskSeq<'W>zipWithAsync3('T -> 'U -> 'V -> #Task<'W>) -> ...zipWith3chunkBy('T -> 'Key) -> TaskSeq<'T> -> TaskSeq<'T[]>chunkByAsync('T -> #Task<'Key>) -> TaskSeq<'T> -> TaskSeq<'T[]>chunkBythreadState('State -> 'T -> 'U * 'State) -> 'State -> TaskSeq<'T> -> TaskSeq<'U>threadStateAsync('State -> 'T -> #Task<'U * 'State>) -> 'State -> TaskSeq<'T> -> TaskSeq<'U>threadStateTest coverage
326 new tests across 6 new test files:
TaskSeq.ReplicateInfinite.Tests.fsreplicateUntilNoneAsyncTaskSeq.FirstLastDefault.Tests.fsTaskSeq.SplitAt.Tests.fsTaskSeq.ZipWith.Tests.fszipWith3TaskSeq.ChunkBy.Tests.fsTaskSeq.ThreadState.Tests.fsChanges
TaskSeqInternal.fsTaskSeq.fsiTaskSeq.fsTaskSeq.*.Tests.fsFSharp.Control.TaskSeq.Test.fsproj(Compile)entriesrelease-notes.txt1.0.0Test Status
✅ Build:
dotnet build src/FSharp.Control.TaskSeq.sln -c Release— succeeded, 0 warnings, 0 errors✅ Format:
dotnet fantomas . --check— all files correctly formatted✅ Tests:
dotnet test ... -c Release— 4,942 passed, 2 skipped (infrastructure), 0 failedNotes
splitAtfollows the same disposal pattern astryTail— the returnedTaskSeq<'T>remainder captures the enumerator and works correctly for in-memory/replayable sequences.replicateInfiniteAsynctakes aunit -> #Task<'T>thunk (not a bareTask<'T>) since Tasks are single-use hot-started computations.chunkByyields consecutive-equal-key chunks (likeSeq.chunkByin AsyncSeq), not groupBy.release-notes.txt— coordinate merging order.Closes #345 (partially — Group 1 functions only; Group 2/3 remain for future work).