diff --git a/src/FSharp.Control.TaskSeq.sln.DotSettings b/src/FSharp.Control.TaskSeq.sln.DotSettings new file mode 100644 index 0000000..560b0f6 --- /dev/null +++ b/src/FSharp.Control.TaskSeq.sln.DotSettings @@ -0,0 +1,5 @@ + + True + True + True + \ No newline at end of file diff --git a/src/FSharp.Control.TaskSeq/TaskSeq.fs b/src/FSharp.Control.TaskSeq/TaskSeq.fs index 02b29e4..7143446 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeq.fs +++ b/src/FSharp.Control.TaskSeq/TaskSeq.fs @@ -320,15 +320,15 @@ type TaskSeq private () = static member exists predicate source = Internal.tryFind (Predicate predicate) source - |> Task.map (Option.isSome) + |> Task.map Option.isSome static member existsAsync predicate source = Internal.tryFind (PredicateAsync predicate) source - |> Task.map (Option.isSome) + |> Task.map Option.isSome static member contains value source = Internal.tryFind (Predicate((=) value)) source - |> Task.map (Option.isSome) + |> Task.map Option.isSome static member pick chooser source = Internal.tryPick (TryPick chooser) source @@ -354,8 +354,6 @@ type TaskSeq private () = Internal.tryFindIndex (PredicateAsync predicate) source |> Task.map (Option.defaultWith Internal.raiseNotFound) - - // // zip/unzip/fold etc functions // diff --git a/src/FSharp.Control.TaskSeq/TaskSeq.fsi b/src/FSharp.Control.TaskSeq/TaskSeq.fsi index 04ef025..38d05ce 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeq.fsi +++ b/src/FSharp.Control.TaskSeq/TaskSeq.fsi @@ -31,7 +31,7 @@ type TaskSeq = /// /// Returns the length of the sequence. This operation requires the whole sequence to be evaluated and - /// should not be used on potentially infinite sequences, see for an alternative. + /// should not be used on potentially infinite sequences, see for an alternative. /// /// /// The input task sequence. @@ -52,7 +52,7 @@ type TaskSeq = /// /// Returns the length of the sequence of all items for which the returns true. /// This operation requires the whole sequence to be evaluated and should not be used on potentially infinite sequences. - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function to test whether an item in the input sequence should be included in the count. @@ -63,7 +63,7 @@ type TaskSeq = /// /// Returns the length of the sequence of all items for which the returns true. /// This operation requires the whole sequence to be evaluated and should not be used on potentially infinite sequences. - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// A function to test whether an item in the input sequence should be included in the count. @@ -157,7 +157,7 @@ type TaskSeq = /// /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function - /// with the curren zero-basedt index, up to the given count. Each element is saved after its initialization for successive access to + /// with the current zero-based index, up to the given count. Each element is saved after its initialization for successive access to /// , which will not re-evaluate the . However, /// re-iterating the returned task sequence will re-evaluate the initialization function. The returned sequence may /// be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should @@ -278,9 +278,9 @@ type TaskSeq = /// /// Views the task sequence in as an F# , that is, an - /// . This function is blocking at each or call - /// to in the resulting sequence. - /// Resources are disposed when the sequence is disposed, or the sequence is exhausted. + /// . This function is blocking at each call + /// to in the resulting sequence. + /// Resources are disposed when the enumerator is disposed, or the enumerator is exhausted. /// /// /// The input task sequence. @@ -451,8 +451,8 @@ type TaskSeq = static member box: source: TaskSeq<'T> -> TaskSeq /// - /// Unboxes to the target type each item in the input task sequence. - /// The target type must be a or a built-in value type. + /// Calls on each item when the task sequence is consumed. + /// The target type must be a value type. /// /// /// The input task sequence. @@ -521,7 +521,6 @@ type TaskSeq = /// /// Builds a new task sequence whose elements are the corresponding elements of the input task /// sequence paired with the integer index (from 0) of each element. - /// Does not evaluate the input sequence until requested. /// /// /// The input task sequence. @@ -530,58 +529,62 @@ type TaskSeq = static member indexed: source: TaskSeq<'T> -> TaskSeq /// - /// Builds a new task sequence whose elements are the results of applying the + /// Builds a new task sequence whose elements are the results of applying the /// function to each of the elements of the input task sequence in . - /// The given function will be applied as elements are pulled using the - /// method on async enumerators retrieved from the input task sequence. - /// Does not evaluate the input sequence until requested. + /// The given function will be applied as elements are pulled using async enumerators retrieved from the + /// input task sequence. + /// + /// If is asynchronous, use . /// /// - /// A function to transform items from the input task sequence. + /// A function to transform items from the input task sequence. /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. static member map: mapper: ('T -> 'U) -> source: TaskSeq<'T> -> TaskSeq<'U> /// - /// Builds a new task sequence whose elements are the results of applying the + /// Builds a new task sequence whose elements are the results of applying the /// function to each of the elements of the input task sequence in , passing - /// an extra zero-based index argument to the function. - /// The given function will be applied as elements are pulled using the - /// method on async enumerators retrieved from the input task sequence. - /// Does not evaluate the input sequence until requested. + /// an extra zero-based index argument to the function. + /// The given function will be applied as elements are pulled using async enumerators retrieved from the + /// input task sequence. + /// + /// If is asynchronous, use . /// /// - /// A function to transform items from the input task sequence that also access the current index. + /// A function to transform items from the input task sequence that also access the current index. /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. static member mapi: mapper: (int -> 'T -> 'U) -> source: TaskSeq<'T> -> TaskSeq<'U> /// - /// Builds a new task sequence whose elements are the results of applying the asynchronous + /// Builds a new task sequence whose elements are the results of applying the asynchronous /// function to each of the elements of the input task sequence in . - /// The given function will be applied as elements are pulled using the - /// method on async enumerators retrieved from the input task sequence. - /// Does not evaluate the input sequence until requested. + /// The given function will be applied as elements are pulled using async enumerators retrieved from the + /// input task sequence. + /// + /// If is synchronous, use . /// /// - /// An asynchronous function to transform items from the input task sequence. + /// An asynchronous function to transform items from the input task sequence. /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. static member mapAsync: mapper: ('T -> #Task<'U>) -> source: TaskSeq<'T> -> TaskSeq<'U> /// - /// Builds a new task sequence whose elements are the results of applying the asynchronous + /// Builds a new task sequence whose elements are the results of applying the asynchronous /// function to each of the elements of the input task sequence in , passing - /// an extra zero-based index argument to the function. - /// The given function will be applied as elements are pulled using the - /// method on async enumerators retrieved from the input task sequence. - /// Does not evaluate the input sequence until requested. + /// an extra zero-based index argument to the function. + /// The given function will be applied as elements are pulled using async enumerators retrieved from the + /// input task sequence. + /// + /// If is synchronous, use . /// /// - /// An asynchronous function to transform items from the input task sequence that also access the current index. + /// An asynchronous function to transform items from the input task sequence that also access the current index. /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. @@ -591,9 +594,10 @@ type TaskSeq = /// Builds a new task sequence whose elements are the results of applying the /// function to each of the elements of the input task sequence in , and concatenating the /// returned task sequences. - /// The given function will be applied as elements are pulled using the - /// method on async enumerators retrieved from the input task sequence. - /// Does not evaluate the input sequence until requested. + /// The given function will be applied as elements are pulled using async enumerators retrieved from the + /// input task sequence. + /// + /// If is asynchronous, use . /// /// /// A function to transform items from the input task sequence into a task sequence. @@ -606,9 +610,10 @@ type TaskSeq = /// Builds a new task sequence whose elements are the results of applying the /// function to each of the elements of the input task sequence in , and concatenating the /// returned regular F# sequences. - /// The given function will be applied as elements are pulled using the - /// method on async enumerators retrieved from the input task sequence. - /// Does not evaluate the input sequence until requested. + /// The given function will be applied as elements are pulled using async enumerators retrieved from the + /// input task sequence. + /// + /// If is asynchronous, use . /// /// /// A function to transform items from the input task sequence into a regular sequence. @@ -621,9 +626,10 @@ type TaskSeq = /// Builds a new task sequence whose elements are the results of applying the asynchronous /// function to each of the elements of the input task sequence in , and concatenating the /// returned task sequences. - /// The given function will be applied as elements are pulled using the - /// method on async enumerators retrieved from the input task sequence. - /// Does not evaluate the input sequence until requested. + /// The given function will be applied as elements are pulled using async enumerators retrieved from the + /// input task sequence. + /// + /// If is synchronous, use . /// /// /// An asynchronous function to transform items from the input task sequence into a task sequence. @@ -637,9 +643,10 @@ type TaskSeq = /// Builds a new task sequence whose elements are the results of applying the asynchronous /// function to each of the elements of the input task sequence in , and concatenating the /// returned regular F# sequences. - /// The given function will be applied as elements are pulled using the - /// method on async enumerators retrieved from the input task sequence. - /// Does not evaluate the input sequence until requested. + /// The given function will be applied as elements are pulled using async enumerators retrieved from the + /// input task sequence. + /// + /// If is synchronous, use . /// /// /// An asynchronous function to transform items from the input task sequence into a regular sequence. @@ -716,6 +723,7 @@ type TaskSeq = /// /// /// The input task sequence. + /// The index of the item to retrieve. /// The nth element of the task sequence, or None if it doesn't exist. /// Thrown when the input task sequence is null. static member tryItem: index: int -> source: TaskSeq<'T> -> Task<'T option> @@ -727,6 +735,7 @@ type TaskSeq = /// /// /// The input task sequence. + /// The index of the item to retrieve. /// The nth element of the task sequence. /// Thrown when the input task sequence is null. /// Thrown when the sequence has insufficient length or is negative. @@ -755,10 +764,10 @@ type TaskSeq = /// /// Applies the given function to each element of the task sequence. Returns /// a sequence comprised of the results where the function returns . - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// - /// A function to transform items of type into options of type . + /// A function to transform items of type into options of type . /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. @@ -768,10 +777,10 @@ type TaskSeq = /// Applies the given asynchronous function to each element of the task sequence. /// Returns a sequence comprised of the results where the function returns a result /// of . - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// - /// An asynchronous function to transform items of type into options of type . + /// An asynchronous function to transform items of type into options of type . /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. @@ -780,7 +789,7 @@ type TaskSeq = /// /// Returns a new task sequence containing only the elements of the collection /// for which the given function returns . - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function to test whether an item in the input sequence should be included in the output or not. @@ -792,7 +801,7 @@ type TaskSeq = /// /// Returns a new task sequence containing only the elements of the input sequence /// for which the given function returns . - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function to test whether an item in the input sequence should be included in the output or not. @@ -804,7 +813,7 @@ type TaskSeq = /// /// Returns a new task sequence containing only the elements of the collection /// for which the given function returns . - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// Alias for . /// @@ -818,7 +827,7 @@ type TaskSeq = /// /// Returns a new task sequence containing only the elements of the input sequence /// for which the given function returns . - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// Alias for . /// @@ -896,7 +905,7 @@ type TaskSeq = /// given function returns , and then returns no further elements. /// The first element where the predicate returns is not included in the resulting sequence /// (see also ). - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function that evaluates to false when no more items should be returned. @@ -910,7 +919,7 @@ type TaskSeq = /// given asynchronous function returns , and then returns no further elements. /// The first element where the predicate returns is not included in the resulting sequence /// (see also ). - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function that evaluates to false when no more items should be returned. @@ -924,7 +933,7 @@ type TaskSeq = /// function returns , returns that element /// and then returns no further elements (see also ). This function returns /// at least one element of a non-empty sequence, or the empty task sequence if the input is empty. - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function that evaluates to false when no more items should be returned. @@ -938,7 +947,7 @@ type TaskSeq = /// asynchronous function returns , returns that element /// and then returns no further elements (see also ). This function returns /// at least one element of a non-empty sequence, or the empty task sequence if the input is empty. - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function that evaluates to false when no more items should be returned. @@ -952,7 +961,7 @@ type TaskSeq = /// given function returns , and then yields the remaining /// elements. The first element where the predicate returns is returned, which means that this /// function will skip 0 or more elements (see also ). - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function that evaluates to false when no more items should be skipped. @@ -966,7 +975,7 @@ type TaskSeq = /// given asynchronous function returns , and then yields the /// remaining elements. The first element where the predicate returns is returned, which /// means that this function will skip 0 or more elements (see also ). - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function that evaluates to false when no more items should be skipped. @@ -980,7 +989,7 @@ type TaskSeq = /// function returns , also skips that element /// and then yields the remaining elements (see also ). This function skips /// at least one element of a non-empty sequence, or returns the empty task sequence if the input is empty. - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// ` /// /// A function that evaluates to false when no more items should be skipped. @@ -994,7 +1003,7 @@ type TaskSeq = /// function returns , also skips that element /// and then yields the remaining elements (see also ). This function skips /// at least one element of a non-empty sequence, or returns the empty task sequence if the input is empty. - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function that evaluates to false when no more items should be skipped. @@ -1006,9 +1015,9 @@ type TaskSeq = /// /// Applies the given function to successive elements, returning the first result where /// the function returns . - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// - /// A function to transform items of type into options of type . + /// A function to transform items of type into options of type . /// The input task sequence. /// The chosen element or . /// Thrown when the input task sequence is null. @@ -1017,9 +1026,9 @@ type TaskSeq = /// /// Applies the given asynchronous function to successive elements, returning the first result where /// the function returns . - /// If is synchronous, consider using . + /// If is synchronous, use . /// - /// An asynchronous function to transform items of type into options of type . + /// An asynchronous function to transform items of type into options of type . /// The input task sequence. /// The chosen element or . /// Thrown when the input task sequence is null. @@ -1028,7 +1037,7 @@ type TaskSeq = /// /// Returns the first element for which the given function returns /// . Returns if no such element exists. - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function that evaluates to a when given an item in the sequence. @@ -1040,7 +1049,7 @@ type TaskSeq = /// /// Returns the first element for which the given asynchronous function returns /// . Returns if no such element exists. - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function that evaluates to a when given an item in the sequence. @@ -1052,7 +1061,7 @@ type TaskSeq = /// /// Returns the index, starting from zero, for which the given function returns /// . Returns if no such element exists. - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function that evaluates to a when given an item in the sequence. @@ -1064,7 +1073,7 @@ type TaskSeq = /// /// Returns the index, starting from zero, for which the given asynchronous function returns /// . Returns if no such element exists. - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function that evaluates to a when given an item in the sequence. @@ -1076,10 +1085,10 @@ type TaskSeq = /// /// Applies the given function to successive elements, returning the first result where /// the function returns . Throws an exception if none is found. - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// - /// A function to transform items of type into options of type . + /// A function to transform items of type into options of type . /// The input sequence. /// The selected element. /// Thrown when the input task sequence is null. @@ -1089,10 +1098,10 @@ type TaskSeq = /// /// Applies the given asynchronous function to successive elements, returning the first result where /// the function returns . Throws an exception if none is found. - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// - /// An asynchronous function to transform items of type into options of type . + /// An asynchronous function to transform items of type into options of type . /// The input sequence. /// The selected element. /// Thrown when the input task sequence is null. @@ -1102,7 +1111,7 @@ type TaskSeq = /// /// Returns the first element for which the given function returns . /// Throws an exception if none is found. - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function that evaluates to a when given an item in the sequence. @@ -1115,7 +1124,7 @@ type TaskSeq = /// /// Returns the first element for which the given asynchronous function returns . /// Throws an exception if none is found. - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function that evaluates to a when given an item in the sequence. @@ -1128,7 +1137,7 @@ type TaskSeq = /// /// Returns the index, starting from zero, of the first element for which the given function /// returns . - /// If is asynchronous, consider using . + /// If is asynchronous, use . /// /// /// A function that evaluates to a when given an item in the sequence. @@ -1141,7 +1150,7 @@ type TaskSeq = /// /// Returns the index, starting from zero, of the first element for which the given function /// returns . - /// If is synchronous, consider using . + /// If is synchronous, use . /// /// /// An asynchronous function that evaluates to a when given an item in the sequence. @@ -1159,7 +1168,7 @@ type TaskSeq = /// /// The value to locate in the input sequence. /// The input task sequence. - /// if the input sequence contains the specified element; otherwise. + /// if the input sequence contains the specified element; otherwise. /// Thrown when the input task sequence is null. static member contains<'T when 'T: equality> : value: 'T -> source: TaskSeq<'T> -> Task @@ -1172,7 +1181,7 @@ type TaskSeq = /// /// A function to test each item of the input sequence. /// The input task sequence. - /// if any result from the predicate is true; otherwise. + /// if any result from the predicate is true; otherwise. /// Thrown when the input task sequence is null. static member exists: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task @@ -1185,7 +1194,7 @@ type TaskSeq = /// /// A function to test each item of the input sequence. /// The input task sequence. - /// if any result from the predicate is true; otherwise. + /// if any result from the predicate is true; otherwise. /// Thrown when the input task sequence is null. static member existsAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task @@ -1239,9 +1248,9 @@ type TaskSeq = /// /// Applies the function to each element in the task sequence, threading an accumulator - /// argument of type through the computation. If the input function is and the elements are + /// argument of type through the computation. If the input function is and the elements are /// then computes . - /// If the accumulator function is asynchronous, consider using . + /// If the accumulator function is asynchronous, use . /// /// /// A function that updates the state with each element from the sequence. @@ -1253,9 +1262,9 @@ type TaskSeq = /// /// Applies the asynchronous function to each element in the task sequence, threading an accumulator - /// argument of type through the computation. If the input function is and the elements are + /// argument of type through the computation. If the input function is and the elements are /// then computes . - /// If the accumulator function is synchronous, consider using . + /// If the accumulator function is synchronous, use . /// /// /// A function that updates the state with each element from the sequence. diff --git a/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fsi b/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fsi index 8c18ca5..4c185be 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fsi +++ b/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fsi @@ -25,8 +25,9 @@ module Internal = val inline raiseNotImpl: unit -> 'a /// -/// Represents a and is the output of using the +/// Represents a task sequence and is the output of using the /// computation expression from this library. It is an alias for . +/// /// The type is deprecated since version 0.4.0, /// please use in its stead. See . /// @@ -34,7 +35,7 @@ module Internal = type taskSeq<'T> = IAsyncEnumerable<'T> /// -/// Represents a and is the output of using the +/// Represents a task sequence and is the output of using the /// computation expression from this library. It is an alias for . /// type TaskSeq<'T> = IAsyncEnumerable<'T> diff --git a/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs b/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs index 8f5da6e..a062acd 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs +++ b/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs @@ -86,7 +86,7 @@ module internal TaskSeqInternal = let empty<'T> = { new IAsyncEnumerable<'T> with - member _.GetAsyncEnumerator(_) = + member _.GetAsyncEnumerator _ = { new IAsyncEnumerator<'T> with member _.MoveNextAsync() = ValueTask.False member _.Current = Unchecked.defaultof<'T> @@ -96,7 +96,7 @@ module internal TaskSeqInternal = let singleton (value: 'T) = { new IAsyncEnumerable<'T> with - member _.GetAsyncEnumerator(_) = + member _.GetAsyncEnumerator _ = let mutable status = BeforeAll { new IAsyncEnumerator<'T> with