Skip to content

Commit

Permalink
Apply review comments, thanks @bartelink, fix naming and doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbraaksma committed Dec 19, 2023
1 parent 492e3e9 commit 0b974f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions src/FSharp.Control.TaskSeq/TaskSeq.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -726,18 +726,20 @@ type TaskSeq =
static member filterAsync: predicate: ('T -> #Task<bool>) -> source: TaskSeq<'T> -> TaskSeq<'T>

/// <summary>
/// Returns a task sequence that, when iterated, skips <paramref name="count" /> elements of the
/// underlying sequence, and then returns the remainder of the elements. Raises an exception if there are not enough
/// elements in the sequence. See <see cref="drop" /> for a version that does not raise an exception.
/// Returns a task sequence that, when iterated, skips <paramref name="count" /> elements of the underlying
/// sequence, and then yields the remainder. Raises an exception if there are not <paramref name="count" />
/// items. See <see cref="drop" /> for a version that does not raise an exception.
/// See also <see cref="take" /> for the inverse of this operation.
/// </summary>
///
/// <param name="count">The number of items to skip.</param>
/// <param name="source">The input task sequence.</param>
/// <returns>The resulting task sequence.</returns>
/// <exception cref="T:ArgumentNullException">Thrown when the input task sequence is null.</exception>
/// <exception cref="T:ArgumentException">Thrown when <paramref name="count" /> is less than zero.</exception>
/// <exception cref="T:InvalidOperationException">Thrown when count exceeds the number of elements in the sequence.</exception>
/// <exception cref="T:ArgumentException">
/// Thrown when <paramref name="count" /> is less than zero or when
/// it exceeds the number of elements in the sequence.
/// </exception>
static member skip: count: int -> source: TaskSeq<'T> -> TaskSeq<'T>


Expand All @@ -748,7 +750,7 @@ type TaskSeq =
/// are not enough elements. See also <see cref="truncate" /> for the inverse of this operation.
/// </summary>
///
/// <param name="count">The number of items to drop.</param>
/// <param name="count">The maximum number of items to drop.</param>
/// <param name="source">The input task sequence.</param>
/// <returns>The resulting task sequence.</returns>
/// <exception cref="T:ArgumentNullException">Thrown when the input task sequence is null.</exception>
Expand All @@ -766,8 +768,10 @@ type TaskSeq =
/// <param name="source">The input task sequence.</param>
/// <returns>The resulting task sequence.</returns>
/// <exception cref="T:ArgumentNullException">Thrown when the input task sequence is null.</exception>
/// <exception cref="T:ArgumentException">Thrown when <paramref name="count" /> is less than zero.</exception>
/// <exception cref="T:InvalidOperationException">Thrown when count exceeds the number of elements in the sequence.</exception>
/// <exception cref="T:ArgumentException">
/// Thrown when <paramref name="count" /> is less than zero or when
/// it exceeds the number of elements in the sequence.
/// </exception>
static member take: count: int -> source: TaskSeq<'T> -> TaskSeq<'T>

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Control.TaskSeq/TaskSeqInternal.fs
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,9 @@ module internal TaskSeqInternal =
use e = source.GetAsyncEnumerator CancellationToken.None

for _ in 1..count do
let! step = e.MoveNextAsync()
let! ok = e.MoveNextAsync()

if not step then
if not ok then
raiseInsufficient ()

while! e.MoveNextAsync() do
Expand Down

0 comments on commit 0b974f8

Please sign in to comment.