[Repo Assist] feat: add TaskSeq.rev, sort, sortDescending, sortBy/Async, sortByDescending/Async, sortWith (101 tests)#309
Closed
github-actions[bot] wants to merge 3 commits intomainfrom
Conversation
…ending/Async, sortWith (101 tests) Implements the remaining sort/rev family of functions that were previously marked as '?' in the README (requiring pre-materialisation before streaming). New functions: - TaskSeq.rev — reverses by materialising into array first - TaskSeq.sort — ascending natural comparison sort - TaskSeq.sortDescending — descending natural comparison sort - TaskSeq.sortBy — ascending sort by projection (sync) - TaskSeq.sortByAsync — ascending sort by projection (async) - TaskSeq.sortByDescending — descending sort by projection (sync) - TaskSeq.sortByDescendingAsync — descending sort by projection (async) - TaskSeq.sortWith — sort using custom comparison function All functions materialise the full input sequence, apply the corresponding Array sort primitive, then stream elements back as a TaskSeq. Includes 101 tests. README and release-notes updated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8 tasks
Contributor
|
Let's not do these, they aren't very useful |
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.
Summary
Implements the sort/rev family of functions that were previously marked ❓ in the README with note #1 (requiring pre-materialisation before streaming).
TaskSeq.revTaskSeq.sortTaskSeq.sortDescendingTaskSeq.sortByTaskSeq.sortByAsyncTaskSeq.sortByDescendingTaskSeq.sortByDescendingAsyncTaskSeq.sortWithDesign
All functions follow the same pattern:
ResizeArrayvia the existingtoResizeArrayAsynchelperArray.*sort primitive (returns a new sorted array — non-mutating)TaskSeqThe async projection variants (
sortByAsync/sortByDescendingAsync) additionally await each key computation sequentially before sorting.Memory note: All these functions hold the entire sequence in memory. This is consistent with how
Seq.sort,Seq.rev, etc. work in FSharp.Core — and is explicitly documented in XML doc comments and the README.Test Status
✅ All tests pass — 3,897 tests pass (2 skipped as usual), including 101 new sort/rev tests.
New tests cover:
Task.FromResultrev ∘ rev = id,sortByDescending = rev ∘ sortBy, sync/async paritysortWithBuild and formatting (Fantomas) both pass.
Changes
TaskSeqInternal.fs— implementations of all 8 functionsTaskSeq.fs— static member wrappersTaskSeq.fsi— XML-doc'd signatures with correct type constraintsTaskSeq.Sort.Tests.fs— 101 new tests (new file)FSharp.Control.TaskSeq.Test.fsproj— adds Sort test fileREADME.md— marks sort/rev as ✅ implementedrelease-notes.txt— adds entry under v0.5.0