Skip to content

Commit 80d2eca

Browse files
authored
Merge branch 'main' into repo-assist/eng-update-fsdocs-22alpha3-20260403-596ea5adde75c6f0
2 parents bceae81 + 148cff8 commit 80d2eca

7 files changed

Lines changed: 181 additions & 105 deletions

File tree

.github/aw/actions-lock.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
"version": "v8",
1111
"sha": "ed597411d8f924073f98dfc5c65a23a2325f34cd"
1212
},
13-
"github/gh-aw-actions/[email protected].4": {
13+
"github/gh-aw-actions/[email protected].6": {
1414
"repo": "github/gh-aw-actions/setup",
15-
"version": "v0.65.4",
16-
"sha": "934698b44320d87a7a9196339f90293f10bd2247"
15+
"version": "v0.65.6",
16+
"sha": "31130b20a8fd3ef263acbe2091267c0aace07e09"
1717
},
18-
"github/gh-aw/actions/[email protected].4": {
18+
"github/gh-aw/actions/[email protected].6": {
1919
"repo": "github/gh-aw/actions/setup",
20-
"version": "v0.65.4",
21-
"sha": "b5a9fb08751b738a86b3b605ff1fdf34956adbf4"
20+
"version": "v0.65.6",
21+
"sha": "296262211b372a13b451ca9400369ac152db75d6"
2222
}
2323
}
2424
}

.github/workflows/repo-assist.lock.yml

Lines changed: 89 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/repo-assist.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ safe-outputs:
6565
target: "*"
6666
title-prefix: "[Repo Assist] "
6767
max: 4
68+
protected-files: fallback-to-issue
6869
create-issue:
6970
title-prefix: "[Repo Assist] "
7071
labels: [automation, repo-assist]
@@ -175,7 +176,7 @@ steps:
175176
json.dump(result, f, indent=2)
176177
EOF
177178
178-
source: githubnext/agentics/workflows/repo-assist.md@e1ecf341a90b7bc2021e77c58685d7e269e20b99
179+
source: githubnext/agentics/workflows/repo-assist.md@4ea8c81959909f40373e2a5c2b7fdb54ea19e0a5
179180
---
180181

181182
# Repo Assist

RELEASE_NOTES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
### 4.12.0
2+
3+
* Added `AsyncSeq.sortAsync` — asynchronous variant of `sort` returning `Async<'T[]>`, avoiding `Async.RunSynchronously` in async workflows.
4+
* Added `AsyncSeq.sortByAsync` — asynchronous variant of `sortBy` returning `Async<'T[]>`.
5+
* Added `AsyncSeq.sortDescendingAsync` — asynchronous variant of `sortDescending` returning `Async<'T[]>`.
6+
* Added `AsyncSeq.sortByDescendingAsync` — asynchronous variant of `sortByDescending` returning `Async<'T[]>`.
7+
* Added `AsyncSeq.sortWithAsync` — asynchronous variant of `sortWith` returning `Async<'T[]>`.
8+
19
### 4.11.0
210

311
* Updated `fsdocs-tool` to 22.0.0-alpha.3 (FSharp.Formatting 22.0.0-alpha.3) and updated SDK to .NET 10.0 (issue #300).

src/FSharp.Control.AsyncSeq/AsyncSeq.fs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,21 @@ module AsyncSeq =
22442244
let sortWith (comparer:'T -> 'T -> int) (source:AsyncSeq<'T>) : array<'T> =
22452245
toSortedSeq (Array.sortWith comparer) source
22462246

2247+
let sortAsync (source:AsyncSeq<'T>) : Async<array<'T>> when 'T : comparison =
2248+
toArrayAsync source |> Async.map Array.sort
2249+
2250+
let sortByAsync (projection:'T -> 'Key) (source:AsyncSeq<'T>) : Async<array<'T>> when 'Key : comparison =
2251+
toArrayAsync source |> Async.map (Array.sortBy projection)
2252+
2253+
let sortDescendingAsync (source:AsyncSeq<'T>) : Async<array<'T>> when 'T : comparison =
2254+
toArrayAsync source |> Async.map Array.sortDescending
2255+
2256+
let sortByDescendingAsync (projection:'T -> 'Key) (source:AsyncSeq<'T>) : Async<array<'T>> when 'Key : comparison =
2257+
toArrayAsync source |> Async.map (Array.sortByDescending projection)
2258+
2259+
let sortWithAsync (comparer:'T -> 'T -> int) (source:AsyncSeq<'T>) : Async<array<'T>> =
2260+
toArrayAsync source |> Async.map (Array.sortWith comparer)
2261+
22472262
let rev (source: AsyncSeq<'T>) : AsyncSeq<'T> = asyncSeq {
22482263
let! arr = toArrayAsync source
22492264
for i in arr.Length - 1 .. -1 .. 0 do

src/FSharp.Control.AsyncSeq/AsyncSeq.fsi

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,26 @@ module AsyncSeq =
730730
/// large or infinite sequences.
731731
val sortWith : comparer:('T -> 'T -> int) -> source:AsyncSeq<'T> -> array<'T>
732732

733+
/// Asynchronously sorts the given async sequence and returns an Async<array<'T>>.
734+
/// Prefer this over sortAsync when composing async workflows.
735+
val sortAsync : source:AsyncSeq<'T> -> Async<array<'T>> when 'T : comparison
736+
737+
/// Asynchronously applies a key-generating function to each element of an AsyncSeq and returns
738+
/// an Async<array<'T>> ordered by keys. Prefer this over sortBy when composing async workflows.
739+
val sortByAsync : projection:('T -> 'Key) -> source:AsyncSeq<'T> -> Async<array<'T>> when 'Key : comparison
740+
741+
/// Asynchronously sorts the given async sequence in descending order and returns an Async<array<'T>>.
742+
/// Prefer this over sortDescending when composing async workflows.
743+
val sortDescendingAsync : source:AsyncSeq<'T> -> Async<array<'T>> when 'T : comparison
744+
745+
/// Asynchronously applies a key-generating function to each element of an AsyncSeq and returns
746+
/// an Async<array<'T>> ordered descending by keys. Prefer this over sortByDescending when composing async workflows.
747+
val sortByDescendingAsync : projection:('T -> 'Key) -> source:AsyncSeq<'T> -> Async<array<'T>> when 'Key : comparison
748+
749+
/// Asynchronously sorts the given async sequence using the given comparison function and returns
750+
/// an Async<array<'T>>. Prefer this over sortWith when composing async workflows.
751+
val sortWithAsync : comparer:('T -> 'T -> int) -> source:AsyncSeq<'T> -> Async<array<'T>>
752+
733753
/// Returns a new async sequence with the elements in reverse order. The entire source
734754
/// sequence is buffered before yielding any elements, mirroring Seq.rev.
735755
/// This function should not be used with large or infinite sequences.

tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,47 @@ let ``AsyncSeq.sortWith returns empty array for empty sequence`` () =
34563456
let result = AsyncSeq.sortWith compare AsyncSeq.empty<int>
34573457
Assert.AreEqual([||], result)
34583458

3459+
// ===== sortAsync / sortByAsync / sortDescendingAsync / sortByDescendingAsync / sortWithAsync =====
3460+
3461+
[<Test>]
3462+
let ``AsyncSeq.sortAsync sorts in ascending order`` () =
3463+
let result = AsyncSeq.ofSeq [ 3; 1; 4; 1; 5; 9 ] |> AsyncSeq.sortAsync |> Async.RunSynchronously
3464+
Assert.AreEqual([| 1; 1; 3; 4; 5; 9 |], result)
3465+
3466+
[<Test>]
3467+
let ``AsyncSeq.sortAsync returns empty array for empty sequence`` () =
3468+
let result = AsyncSeq.empty<int> |> AsyncSeq.sortAsync |> Async.RunSynchronously
3469+
Assert.AreEqual([||], result)
3470+
3471+
[<Test>]
3472+
let ``AsyncSeq.sortByAsync sorts by projected key`` () =
3473+
let result =
3474+
AsyncSeq.ofSeq [ "banana"; "apple"; "cherry" ]
3475+
|> AsyncSeq.sortByAsync (fun s -> s.Length)
3476+
|> Async.RunSynchronously
3477+
Assert.AreEqual([| "apple"; "banana"; "cherry" |], result)
3478+
3479+
[<Test>]
3480+
let ``AsyncSeq.sortDescendingAsync sorts in descending order`` () =
3481+
let result = AsyncSeq.ofSeq [ 3; 1; 4; 1; 5 ] |> AsyncSeq.sortDescendingAsync |> Async.RunSynchronously
3482+
Assert.AreEqual([| 5; 4; 3; 1; 1 |], result)
3483+
3484+
[<Test>]
3485+
let ``AsyncSeq.sortByDescendingAsync sorts by projected key descending`` () =
3486+
let result =
3487+
AsyncSeq.ofSeq [ "apple"; "banana"; "fig" ]
3488+
|> AsyncSeq.sortByDescendingAsync (fun s -> s.Length)
3489+
|> Async.RunSynchronously
3490+
Assert.AreEqual([| "banana"; "apple"; "fig" |], result)
3491+
3492+
[<Test>]
3493+
let ``AsyncSeq.sortWithAsync sorts using custom comparer`` () =
3494+
let result =
3495+
AsyncSeq.ofSeq [ 3; 1; 4; 1; 5 ]
3496+
|> AsyncSeq.sortWithAsync (fun a b -> compare b a)
3497+
|> Async.RunSynchronously
3498+
Assert.AreEqual([| 5; 4; 3; 1; 1 |], result)
3499+
34593500
// ── AsyncSeq.mapFold ──────────────────────────────────────────────────────────
34603501

34613502
[<Test>]

0 commit comments

Comments
 (0)