Skip to content

Commit

Permalink
Fix and simplify code for TaskSeq.drop
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbraaksma committed Dec 19, 2023
1 parent 6e6821e commit dd5b085
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/FSharp.Control.TaskSeq/TaskSeqInternal.fs
Original file line number Diff line number Diff line change
Expand Up @@ -672,14 +672,16 @@ module internal TaskSeqInternal =
// skip, or stop looping if we reached the end
while cont do
pos <- pos + 1
let! moveNext = e.MoveNextAsync()
cont <- moveNext && pos <= count

if pos < count then
let! moveNext = e.MoveNextAsync()
cont <- moveNext
else
cont <- false

// return the rest
while cont do
while! e.MoveNextAsync() do
yield e.Current
let! moveNext = e.MoveNextAsync()
cont <- moveNext

}
| Take ->
Expand Down

0 comments on commit dd5b085

Please sign in to comment.