Skip to content

Commit

Permalink
Fix TaskSeq.zip (consider not throwing an exception? See #32)
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbraaksma committed Oct 16, 2022
1 parent 92fcfd0 commit b54ef8f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/FSharpy.TaskSeq/TaskSeqInternal.fs
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,23 @@ module internal TaskSeqInternal =
let e2 = taskSequence2.GetAsyncEnumerator(CancellationToken())
let mutable go = true
let! step1 = e1.MoveNextAsync()
let! step2 = e1.MoveNextAsync()
let! step2 = e2.MoveNextAsync()
go <- step1 && step2

while go do
yield e1.Current, e2.Current
let! step1 = e1.MoveNextAsync()
let! step2 = e1.MoveNextAsync()
go <- step1 && step2
let! step2 = e2.MoveNextAsync()

if step1 <> step2 then
if step1 then
invalidArg "taskSequence1" "The task sequences have different lengths."

if step1 then
invalidArg "taskSequence1" "The task sequences have different lengths."
if step2 then
invalidArg "taskSequence2" "The task sequences have different lengths."

go <- step1 && step2

if step2 then
invalidArg "taskSequence2" "The task sequences have different lengths."
}

let collect (binder: _ -> #IAsyncEnumerable<_>) (taskSequence: taskSeq<_>) = taskSeq {
Expand Down

0 comments on commit b54ef8f

Please sign in to comment.