Conversation
…ByAsync Adds six generic numeric aggregation functions aligned with F#'s Seq module API: - TaskSeq.sum: sums elements using the (+) operator (SRTP) - TaskSeq.sumBy / sumByAsync: sums projected values - TaskSeq.average: averages elements using (+) and DivideByInt (SRTP) - TaskSeq.averageBy / averageByAsync: averages projected values All six are module-level inline functions in TaskSeqExtensions.TaskSeq, which avoids FS1113 errors that occur with type static inline members when SRTP operators are resolved at cross-assembly call sites. The inline bodies directly implement the accumulation loop, following the same pattern as FSharp.Core's Seq.sum. Includes 147 tests covering: null source, empty sequence (zero for sum, exception for average), sequences of int/float/int64/float32, single element, side-effect counting, and immutable variant enumeration (1..10, sum=55, avg=5.5). Also relaxes global.json SDK constraint from patch-exact to latestPatch so the build works with any 10.0.x SDK available in the environment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
23 tasks
dsyme
approved these changes
Mar 7, 2026
github-actions bot
added a commit
that referenced
this pull request
Mar 8, 2026
Mark as implemented (✅) following the wave of PRs merged for v0.6.0: - TaskSeq.average, averageBy, averageByAsync (#304) - TaskSeq.sum, sumBy, sumByAsync (#304) - TaskSeq.distinct, distinctBy, distinctByAsync, distinctUntilChanged (#305) - TaskSeq.mapFold, mapFoldAsync (#306) - TaskSeq.groupBy, groupByAsync (#307) - TaskSeq.countBy, countByAsync — add missing table row (#307) - TaskSeq.partition, partitionAsync — add missing table row (#307) Also: - Fix typo 'dictinctBy' → 'distinctBy' - Update 'Status & planning' checklist to reflect completed work - Add PR link definitions (#304–#307) at the bottom Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Adds six generic numeric aggregation functions to
TaskSeq, aligned with F#'sSeqmodule API:TaskSeq.sum+operator via SRTP)TaskSeq.sumByTaskSeq.sumByAsyncTaskSeq.average+andDivideByIntvia SRTP)TaskSeq.averageByTaskSeq.averageByAsyncWorks with all built-in numeric types (
int,float,float32,int64, etc.).average/averageBy/averageByAsyncrequireDivideByInt, so they work with floating-point types only (same constraint asSeq.average).Design Notes
These are module-level
inlinefunctions inTaskSeqExtensions.TaskSeq, following the same pattern asSeq.sum,Array.sum, etc. in FSharp.Core. This is intentional:inlinemembers in[(Sealed; AbstractClass)]types trigger FS1113 when SRTP operators are resolved at cross-assembly call sites (the inline body is expanded in the calling assembly, which cannot access internal F# Core machinery)let inlinefunctions do not have this restriction — FSharp.Core uses this pattern throughoutThe functions are accessible as
TaskSeq.sum,TaskSeq.sumBy, etc. — identical to calling static members.Example
Files Changed
src/FSharp.Control.TaskSeq/TaskSeq.fs: Added 6 module-level inline functionssrc/FSharp.Control.TaskSeq/TaskSeq.fsi: Added signatures toTaskSeqExtensions.TaskSeqmodulesrc/FSharp.Control.TaskSeq.Test/TaskSeq.SumBy.Tests.fs: 147 new testssrc/FSharp.Control.TaskSeq.Test/FSharp.Control.TaskSeq.Test.fsproj: Included new test filerelease-notes.txt: Added entry for new functionsglobal.json: ChangedrollForwardfromminortolatestPatchto accept any10.0.xSDK ≥10.0.100Test Status
✅ Library build:
dotnet build src/FSharp.Control.TaskSeq/FSharp.Control.TaskSeq.fsproj -c Release— 0 warnings, 0 errors✅ Full test suite:
dotnet test src/FSharp.Control.TaskSeq.Test -c Release— 3997 passed, 2 skipped (the 2 skipped are pre-existing infrastructure/real-world stream tests)✅ Formatting:
dotnet fantomas .— no changes needed after final buildNew tests cover:
ArgumentNullExceptionArgumentException1..10sequence: sum = 55, average = 5.5int,float,float32,int64