Skip to content

Commit 708a4b6

Browse files
committed
Apply review comments, small clarifications/code improvements, tx @bartelink
1 parent ef920c1 commit 708a4b6

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/FSharp.Control.TaskSeq/TaskSeq.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ type TaskSeq =
889889
/// Returns a task sequence that, when iterated, skips elements of the underlying sequence while the
890890
/// given asynchronous function <paramref name="predicate" /> returns <see cref="true" />, and then yields the
891891
/// remaining elements. The first element where the predicate returns <see cref="false" /> is returned, which
892-
/// means that this function will skip 0 or more elements (see also <see cref="TaskSeq.skipWhileInclusive" />).
892+
/// means that this function will skip 0 or more elements (see also <see cref="TaskSeq.skipWhileInclusiveAsync" />).
893893
/// If <paramref name="predicate" /> is synchronous, consider using <see cref="TaskSeq.skipWhile" />.
894894
/// </summary>
895895
///

src/FSharp.Control.TaskSeq/TaskSeqInternal.fs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type internal AsyncEnumStatus =
1313

1414
[<Struct>]
1515
type internal WhileKind =
16-
/// The item under test is included (or skipped) even if false
16+
/// The item under test is included (or skipped) even when the predicate returns false
1717
| Inclusive
1818
/// The item under test is always excluded (or not skipped)
1919
| Exclusive
@@ -648,9 +648,9 @@ module internal TaskSeqInternal =
648648
use e = source.GetAsyncEnumerator CancellationToken.None
649649

650650
for _ in 1..count do
651-
let! ok = e.MoveNextAsync()
651+
let! hasMore = e.MoveNextAsync()
652652

653-
if not ok then
653+
if not hasMore then
654654
raiseInsufficient ()
655655

656656
while! e.MoveNextAsync() do
@@ -731,8 +731,8 @@ module internal TaskSeqInternal =
731731

732732
taskSeq {
733733
use e = source.GetAsyncEnumerator CancellationToken.None
734-
let! moveFirst = e.MoveNextAsync()
735-
let mutable more = moveFirst
734+
let! notEmpty = e.MoveNextAsync()
735+
let mutable more = notEmpty
736736

737737
match whileKind, predicate with
738738
| Exclusive, Predicate predicate -> // takeWhile
@@ -743,20 +743,20 @@ module internal TaskSeqInternal =
743743
if more then
744744
// yield ONLY if predicate is true
745745
yield value
746-
let! ok = e.MoveNextAsync()
747-
more <- ok
746+
let! hasMore = e.MoveNextAsync()
747+
more <- hasMore
748748

749749
| Inclusive, Predicate predicate -> // takeWhileInclusive
750750
while more do
751751
let value = e.Current
752752
more <- predicate value
753753

754-
// yield, regardless of result of predicate
754+
// yield regardless of result of predicate
755755
yield value
756756

757757
if more then
758-
let! ok = e.MoveNextAsync()
759-
more <- ok
758+
let! hasMore = e.MoveNextAsync()
759+
more <- hasMore
760760

761761
| Exclusive, PredicateAsync predicate -> // takeWhileAsync
762762
while more do
@@ -767,8 +767,8 @@ module internal TaskSeqInternal =
767767
if more then
768768
// yield ONLY if predicate is true
769769
yield value
770-
let! ok = e.MoveNextAsync()
771-
more <- ok
770+
let! hasMore = e.MoveNextAsync()
771+
more <- hasMore
772772

773773
| Inclusive, PredicateAsync predicate -> // takeWhileInclusiveAsync
774774
while more do
@@ -780,8 +780,8 @@ module internal TaskSeqInternal =
780780
yield value
781781

782782
if more then
783-
let! ok = e.MoveNextAsync()
784-
more <- ok
783+
let! hasMore = e.MoveNextAsync()
784+
more <- hasMore
785785
}
786786

787787
let skipWhile whileKind predicate (source: TaskSeq<_>) =
@@ -795,8 +795,8 @@ module internal TaskSeqInternal =
795795
match whileKind, predicate with
796796
| Exclusive, Predicate predicate -> // skipWhile
797797
while more && predicate e.Current do
798-
let! ok = e.MoveNextAsync()
799-
more <- ok
798+
let! hasMore = e.MoveNextAsync()
799+
more <- hasMore
800800

801801
if more then
802802
// yield the last one where the predicate was false
@@ -808,8 +808,8 @@ module internal TaskSeqInternal =
808808

809809
| Inclusive, Predicate predicate -> // skipWhileInclusive
810810
while more && predicate e.Current do
811-
let! ok = e.MoveNextAsync()
812-
more <- ok
811+
let! hasMore = e.MoveNextAsync()
812+
more <- hasMore
813813

814814
if more then
815815
// yield the rest (this ensures we skip 1 or more)
@@ -820,15 +820,15 @@ module internal TaskSeqInternal =
820820
let mutable cont = true
821821

822822
if more then
823-
let! ok = predicate e.Current
824-
cont <- ok
823+
let! hasMore = predicate e.Current
824+
cont <- hasMore
825825

826826
while more && cont do
827827
let! moveNext = e.MoveNextAsync()
828828

829829
if moveNext then
830-
let! ok = predicate e.Current
831-
cont <- ok
830+
let! hasMore = predicate e.Current
831+
cont <- hasMore
832832

833833
more <- moveNext
834834

@@ -844,15 +844,15 @@ module internal TaskSeqInternal =
844844
let mutable cont = true
845845

846846
if more then
847-
let! ok = predicate e.Current
848-
cont <- ok
847+
let! hasMore = predicate e.Current
848+
cont <- hasMore
849849

850850
while more && cont do
851851
let! moveNext = e.MoveNextAsync()
852852

853853
if moveNext then
854-
let! ok = predicate e.Current
855-
cont <- ok
854+
let! hasMore = predicate e.Current
855+
cont <- hasMore
856856

857857
more <- moveNext
858858

0 commit comments

Comments
 (0)