diff --git a/README.md b/README.md index 60a2cd9c..6fe96a29 100644 --- a/README.md +++ b/README.md @@ -463,93 +463,93 @@ The following are the current surface area of the `TaskSeq` utility functions, o ```f# module TaskSeq = - val append: source1: taskSeq<'T> -> source2: taskSeq<'T> -> taskSeq<'T> - val appendSeq: source1: taskSeq<'T> -> source2: seq<'T> -> taskSeq<'T> - val box: source: taskSeq<'T> -> taskSeq - val cast: source: taskSeq -> taskSeq<'T> - val choose: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> taskSeq<'U> - val chooseAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> taskSeq<'U> - val collect: binder: ('T -> #taskSeq<'U>) -> source: taskSeq<'T> -> taskSeq<'U> - val collectAsync: binder: ('T -> #Task<'TSeqU>) -> source: taskSeq<'T> -> taskSeq<'U> when 'TSeqU :> taskSeq<'U> - val collectSeq: binder: ('T -> #seq<'U>) -> source: taskSeq<'T> -> taskSeq<'U> - val collectSeqAsync: binder: ('T -> #Task<'SeqU>) -> source: taskSeq<'T> -> taskSeq<'U> when 'SeqU :> seq<'U> - val concat: sources: taskSeq<#taskSeq<'T>> -> taskSeq<'T> - val contains<'T when 'T: equality> : value: 'T -> source: taskSeq<'T> -> Task - val delay: generator: (unit -> taskSeq<'T>) -> taskSeq<'T> - val empty<'T> : taskSeq<'T> - val exactlyOne: source: taskSeq<'T> -> Task<'T> - val except<'T when 'T: equality> : itemsToExclude: taskSeq<'T> -> source: taskSeq<'T> -> taskSeq<'T> - val exceptOfSeq<'T when 'T: equality> : itemsToExclude: seq<'T> -> source: taskSeq<'T> -> taskSeq<'T> - val exists: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task - val existsAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task - val filter: predicate: ('T -> bool) -> source: taskSeq<'T> -> taskSeq<'T> - val filterAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> taskSeq<'T> - val find: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task<'T> - val findAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task<'T> - val findIndex: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task - val findIndexAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task - val fold: folder: ('State -> 'T -> 'State) -> state: 'State -> source: taskSeq<'T> -> Task<'State> - val foldAsync: folder: ('State -> 'T -> #Task<'State>) -> state: 'State -> source: taskSeq<'T> -> Task<'State> - val head: source: taskSeq<'T> -> Task<'T> - val indexed: source: taskSeq<'T> -> taskSeq - val init: count: int -> initializer: (int -> 'T) -> taskSeq<'T> - val initAsync: count: int -> initializer: (int -> #Task<'T>) -> taskSeq<'T> - val initInfinite: initializer: (int -> 'T) -> taskSeq<'T> - val initInfiniteAsync: initializer: (int -> #Task<'T>) -> taskSeq<'T> - val isEmpty: source: taskSeq<'T> -> Task - val item: index: int -> source: taskSeq<'T> -> Task<'T> - val iter: action: ('T -> unit) -> source: taskSeq<'T> -> Task - val iterAsync: action: ('T -> #Task) -> source: taskSeq<'T> -> Task - val iteri: action: (int -> 'T -> unit) -> source: taskSeq<'T> -> Task - val iteriAsync: action: (int -> 'T -> #Task) -> source: taskSeq<'T> -> Task - val last: source: taskSeq<'T> -> Task<'T> - val length: source: taskSeq<'T> -> Task - val lengthBy: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task - val lengthByAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task - val lengthOrMax: max: int -> source: taskSeq<'T> -> Task - val map: mapper: ('T -> 'U) -> source: taskSeq<'T> -> taskSeq<'U> - val mapAsync: mapper: ('T -> #Task<'U>) -> source: taskSeq<'T> -> taskSeq<'U> - val mapi: mapper: (int -> 'T -> 'U) -> source: taskSeq<'T> -> taskSeq<'U> - val mapiAsync: mapper: (int -> 'T -> #Task<'U>) -> source: taskSeq<'T> -> taskSeq<'U> - val ofArray: source: 'T[] -> taskSeq<'T> - val ofAsyncArray: source: Async<'T> array -> taskSeq<'T> - val ofAsyncList: source: Async<'T> list -> taskSeq<'T> - val ofAsyncSeq: source: seq> -> taskSeq<'T> - val ofList: source: 'T list -> taskSeq<'T> - val ofResizeArray: source: ResizeArray<'T> -> taskSeq<'T> - val ofSeq: source: seq<'T> -> taskSeq<'T> - val ofTaskArray: source: #Task<'T> array -> taskSeq<'T> - val ofTaskList: source: #Task<'T> list -> taskSeq<'T> - val ofTaskSeq: source: seq<#Task<'T>> -> taskSeq<'T> - val pick: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> Task<'U> - val pickAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> Task<'U> - val prependSeq: source1: seq<'T> -> source2: taskSeq<'T> -> taskSeq<'T> - val singleton: source: 'T -> taskSeq<'T> - val tail: source: taskSeq<'T> -> Task> - val takeWhile: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task> - val takeWhileAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task> - val takeWhileInclusive: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task> - val takeWhileInclusiveAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task> - val toArray: source: taskSeq<'T> -> 'T[] - val toArrayAsync: source: taskSeq<'T> -> Task<'T[]> - val toIListAsync: source: taskSeq<'T> -> Task> - val toList: source: taskSeq<'T> -> 'T list - val toListAsync: source: taskSeq<'T> -> Task<'T list> - val toResizeArrayAsync: source: taskSeq<'T> -> Task> - val toSeq: source: taskSeq<'T> -> seq<'T> - val tryExactlyOne: source: taskSeq<'T> -> Task<'T option> - val tryFind: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task<'T option> - val tryFindAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task<'T option> - val tryFindIndex: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task - val tryFindIndexAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task - val tryHead: source: taskSeq<'T> -> Task<'T option> - val tryItem: index: int -> source: taskSeq<'T> -> Task<'T option> - val tryLast: source: taskSeq<'T> -> Task<'T option> - val tryPick: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> Task<'U option> - val tryPickAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> Task<'U option> - val tryTail: source: taskSeq<'T> -> Task option> - val unbox<'U when 'U: struct> : source: taskSeq -> taskSeq<'U> - val zip: source1: taskSeq<'T> -> source2: taskSeq<'U> -> taskSeq<'T * 'U> + val append: source1: TaskSeq<'T> -> source2: TaskSeq<'T> -> TaskSeq<'T> + val appendSeq: source1: TaskSeq<'T> -> source2: seq<'T> -> TaskSeq<'T> + val box: source: TaskSeq<'T> -> TaskSeq + val cast: source: TaskSeq -> TaskSeq<'T> + val choose: chooser: ('T -> 'U option) -> source: TaskSeq<'T> -> TaskSeq<'U> + val chooseAsync: chooser: ('T -> #Task<'U option>) -> source: TaskSeq<'T> -> TaskSeq<'U> + val collect: binder: ('T -> #TaskSeq<'U>) -> source: TaskSeq<'T> -> TaskSeq<'U> + val collectAsync: binder: ('T -> #Task<'TSeqU>) -> source: TaskSeq<'T> -> TaskSeq<'U> when 'TSeqU :> TaskSeq<'U> + val collectSeq: binder: ('T -> #seq<'U>) -> source: TaskSeq<'T> -> TaskSeq<'U> + val collectSeqAsync: binder: ('T -> #Task<'SeqU>) -> source: TaskSeq<'T> -> TaskSeq<'U> when 'SeqU :> seq<'U> + val concat: sources: TaskSeq<#TaskSeq<'T>> -> TaskSeq<'T> + val contains<'T when 'T: equality> : value: 'T -> source: TaskSeq<'T> -> Task + val delay: generator: (unit -> TaskSeq<'T>) -> TaskSeq<'T> + val empty<'T> : TaskSeq<'T> + val exactlyOne: source: TaskSeq<'T> -> Task<'T> + val except<'T when 'T: equality> : itemsToExclude: TaskSeq<'T> -> source: TaskSeq<'T> -> TaskSeq<'T> + val exceptOfSeq<'T when 'T: equality> : itemsToExclude: seq<'T> -> source: TaskSeq<'T> -> TaskSeq<'T> + val exists: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task + val existsAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task + val filter: predicate: ('T -> bool) -> source: TaskSeq<'T> -> TaskSeq<'T> + val filterAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> TaskSeq<'T> + val find: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task<'T> + val findAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task<'T> + val findIndex: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task + val findIndexAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task + val fold: folder: ('State -> 'T -> 'State) -> state: 'State -> source: TaskSeq<'T> -> Task<'State> + val foldAsync: folder: ('State -> 'T -> #Task<'State>) -> state: 'State -> source: TaskSeq<'T> -> Task<'State> + val head: source: TaskSeq<'T> -> Task<'T> + val indexed: source: TaskSeq<'T> -> TaskSeq + val init: count: int -> initializer: (int -> 'T) -> TaskSeq<'T> + val initAsync: count: int -> initializer: (int -> #Task<'T>) -> TaskSeq<'T> + val initInfinite: initializer: (int -> 'T) -> TaskSeq<'T> + val initInfiniteAsync: initializer: (int -> #Task<'T>) -> TaskSeq<'T> + val isEmpty: source: TaskSeq<'T> -> Task + val item: index: int -> source: TaskSeq<'T> -> Task<'T> + val iter: action: ('T -> unit) -> source: TaskSeq<'T> -> Task + val iterAsync: action: ('T -> #Task) -> source: TaskSeq<'T> -> Task + val iteri: action: (int -> 'T -> unit) -> source: TaskSeq<'T> -> Task + val iteriAsync: action: (int -> 'T -> #Task) -> source: TaskSeq<'T> -> Task + val last: source: TaskSeq<'T> -> Task<'T> + val length: source: TaskSeq<'T> -> Task + val lengthBy: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task + val lengthByAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task + val lengthOrMax: max: int -> source: TaskSeq<'T> -> Task + val map: mapper: ('T -> 'U) -> source: TaskSeq<'T> -> TaskSeq<'U> + val mapAsync: mapper: ('T -> #Task<'U>) -> source: TaskSeq<'T> -> TaskSeq<'U> + val mapi: mapper: (int -> 'T -> 'U) -> source: TaskSeq<'T> -> TaskSeq<'U> + val mapiAsync: mapper: (int -> 'T -> #Task<'U>) -> source: TaskSeq<'T> -> TaskSeq<'U> + val ofArray: source: 'T[] -> TaskSeq<'T> + val ofAsyncArray: source: Async<'T> array -> TaskSeq<'T> + val ofAsyncList: source: Async<'T> list -> TaskSeq<'T> + val ofAsyncSeq: source: seq> -> TaskSeq<'T> + val ofList: source: 'T list -> TaskSeq<'T> + val ofResizeArray: source: ResizeArray<'T> -> TaskSeq<'T> + val ofSeq: source: seq<'T> -> TaskSeq<'T> + val ofTaskArray: source: #Task<'T> array -> TaskSeq<'T> + val ofTaskList: source: #Task<'T> list -> TaskSeq<'T> + val ofTaskSeq: source: seq<#Task<'T>> -> TaskSeq<'T> + val pick: chooser: ('T -> 'U option) -> source: TaskSeq<'T> -> Task<'U> + val pickAsync: chooser: ('T -> #Task<'U option>) -> source: TaskSeq<'T> -> Task<'U> + val prependSeq: source1: seq<'T> -> source2: TaskSeq<'T> -> TaskSeq<'T> + val singleton: source: 'T -> TaskSeq<'T> + val tail: source: TaskSeq<'T> -> Task> + val takeWhile: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task> + val takeWhileAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task> + val takeWhileInclusive: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task> + val takeWhileInclusiveAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task> + val toArray: source: TaskSeq<'T> -> 'T[] + val toArrayAsync: source: TaskSeq<'T> -> Task<'T[]> + val toIListAsync: source: TaskSeq<'T> -> Task> + val toList: source: TaskSeq<'T> -> 'T list + val toListAsync: source: TaskSeq<'T> -> Task<'T list> + val toResizeArrayAsync: source: TaskSeq<'T> -> Task> + val toSeq: source: TaskSeq<'T> -> seq<'T> + val tryExactlyOne: source: TaskSeq<'T> -> Task<'T option> + val tryFind: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task<'T option> + val tryFindAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task<'T option> + val tryFindIndex: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task + val tryFindIndexAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task + val tryHead: source: TaskSeq<'T> -> Task<'T option> + val tryItem: index: int -> source: TaskSeq<'T> -> Task<'T option> + val tryLast: source: TaskSeq<'T> -> Task<'T option> + val tryPick: chooser: ('T -> 'U option) -> source: TaskSeq<'T> -> Task<'U option> + val tryPickAsync: chooser: ('T -> #Task<'U option>) -> source: TaskSeq<'T> -> Task<'U option> + val tryTail: source: TaskSeq<'T> -> Task option> + val unbox<'U when 'U: struct> : source: TaskSeq -> TaskSeq<'U> + val zip: source1: TaskSeq<'T> -> source2: TaskSeq<'U> -> TaskSeq<'T * 'U> ``` [buildstatus]: https://github.com/fsprojects/FSharp.Control.TaskSeq/actions/workflows/main.yaml diff --git a/release-notes.txt b/release-notes.txt index 5db65a5d..de5ed45a 100644 --- a/release-notes.txt +++ b/release-notes.txt @@ -1,7 +1,8 @@ Release notes: 0.4.x (unreleased) - - fix documentation, improve tooltips experience, add exception info to every method + - overhaul all doc comments, add exceptions info, improve tooltips experience, #136 + - DEPRECATED: type 'TaskSeq<'T>' now replaces 'taskSeq<'T>', the latter deprecated FS0044, #187 - BINARY INCOMPATIBLE: TaskSeq module members are now static members, source code compatible, #186 0.4.0-alpha.1 diff --git a/src/FSharp.Control.TaskSeq.Test/TaskSeq.Tests.CE.fs b/src/FSharp.Control.TaskSeq.Test/TaskSeq.Tests.CE.fs index d4fee3b0..4ae88e66 100644 --- a/src/FSharp.Control.TaskSeq.Test/TaskSeq.Tests.CE.fs +++ b/src/FSharp.Control.TaskSeq.Test/TaskSeq.Tests.CE.fs @@ -11,7 +11,7 @@ open FSharp.Control let ``CE taskSeq using yield! with null`` () = task { let ts = taskSeq { yield! Gen.sideEffectTaskSeq 10 - yield! (null: taskSeq) + yield! (null: TaskSeq) } fun () -> TaskSeq.toList ts diff --git a/src/FSharp.Control.TaskSeq/AsyncExtensions.fs b/src/FSharp.Control.TaskSeq/AsyncExtensions.fs index 25817526..0230395f 100644 --- a/src/FSharp.Control.TaskSeq/AsyncExtensions.fs +++ b/src/FSharp.Control.TaskSeq/AsyncExtensions.fs @@ -6,7 +6,7 @@ module AsyncExtensions = // Add asynchronous for loop to the 'async' computation builder type Microsoft.FSharp.Control.AsyncBuilder with - member _.For(source: taskSeq<'T>, action: 'T -> Async) = + member _.For(source: TaskSeq<'T>, action: 'T -> Async) = source |> TaskSeq.iterAsync (action >> Async.StartAsTask) |> Async.AwaitTask diff --git a/src/FSharp.Control.TaskSeq/AsyncExtensions.fsi b/src/FSharp.Control.TaskSeq/AsyncExtensions.fsi index cf96281e..16b00486 100644 --- a/src/FSharp.Control.TaskSeq/AsyncExtensions.fsi +++ b/src/FSharp.Control.TaskSeq/AsyncExtensions.fsi @@ -8,4 +8,4 @@ module AsyncExtensions = /// /// Inside , iterate over all values of a . /// - member For: source: taskSeq<'T> * action: ('T -> Async) -> Async + member For: source: TaskSeq<'T> * action: ('T -> Async) -> Async diff --git a/src/FSharp.Control.TaskSeq/TaskExtensions.fs b/src/FSharp.Control.TaskSeq/TaskExtensions.fs index dc592f97..f43211aa 100644 --- a/src/FSharp.Control.TaskSeq/TaskExtensions.fs +++ b/src/FSharp.Control.TaskSeq/TaskExtensions.fs @@ -56,7 +56,7 @@ module TaskExtensions = false) ) - member inline this.For(source: taskSeq<'T>, body: 'T -> TaskCode<_, unit>) : TaskCode<_, unit> = + member inline this.For(source: TaskSeq<'T>, body: 'T -> TaskCode<_, unit>) : TaskCode<_, unit> = TaskCode<'TOverall, unit>(fun sm -> this .Using( diff --git a/src/FSharp.Control.TaskSeq/TaskExtensions.fsi b/src/FSharp.Control.TaskSeq/TaskExtensions.fsi index 76cd8f9d..e1c540e7 100644 --- a/src/FSharp.Control.TaskSeq/TaskExtensions.fsi +++ b/src/FSharp.Control.TaskSeq/TaskExtensions.fsi @@ -10,4 +10,4 @@ module TaskExtensions = /// /// Inside , iterate over all values of a . /// - member inline For: source: taskSeq<'T> * body: ('T -> TaskCode<'TOverall, unit>) -> TaskCode<'TOverall, unit> + member inline For: source: TaskSeq<'T> * body: ('T -> TaskCode<'TOverall, unit>) -> TaskCode<'TOverall, unit> diff --git a/src/FSharp.Control.TaskSeq/TaskSeq.fs b/src/FSharp.Control.TaskSeq/TaskSeq.fs index a06c3e79..68119755 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeq.fs +++ b/src/FSharp.Control.TaskSeq/TaskSeq.fs @@ -38,7 +38,7 @@ type TaskSeq private () = // Convert 'ToXXX' functions // - static member toList(source: taskSeq<'T>) = [ + static member toList(source: TaskSeq<'T>) = [ Internal.checkNonNull (nameof source) source let e = source.GetAsyncEnumerator(CancellationToken()) @@ -49,7 +49,7 @@ type TaskSeq private () = e.DisposeAsync().AsTask().Wait() ] - static member toArray(source: taskSeq<'T>) = [| + static member toArray(source: TaskSeq<'T>) = [| Internal.checkNonNull (nameof source) source let e = source.GetAsyncEnumerator(CancellationToken()) @@ -60,7 +60,7 @@ type TaskSeq private () = e.DisposeAsync().AsTask().Wait() |] - static member toSeq(source: taskSeq<'T>) = + static member toSeq(source: TaskSeq<'T>) = Internal.checkNonNull (nameof source) source seq { @@ -178,21 +178,21 @@ type TaskSeq private () = static member initAsync count initializer = Internal.init (Some count) (InitActionAsync initializer) static member initInfiniteAsync initializer = Internal.init None (InitActionAsync initializer) - static member delay(generator: unit -> taskSeq<'T>) = + static member delay(generator: unit -> TaskSeq<'T>) = { new IAsyncEnumerable<'T> with member _.GetAsyncEnumerator(ct) = generator().GetAsyncEnumerator(ct) } - static member concat(sources: taskSeq<#taskSeq<'T>>) = + static member concat(sources: TaskSeq<#TaskSeq<'T>>) = Internal.checkNonNull (nameof sources) sources taskSeq { for ts in sources do // no null-check of inner taskseqs, similar to seq - yield! (ts :> taskSeq<'T>) + yield! (ts :> TaskSeq<'T>) } - static member append (source1: taskSeq<'T>) (source2: taskSeq<'T>) = + static member append (source1: TaskSeq<'T>) (source2: TaskSeq<'T>) = Internal.checkNonNull (nameof source1) source1 Internal.checkNonNull (nameof source2) source2 @@ -201,7 +201,7 @@ type TaskSeq private () = yield! source2 } - static member appendSeq (source1: taskSeq<'T>) (source2: seq<'T>) = + static member appendSeq (source1: TaskSeq<'T>) (source2: seq<'T>) = Internal.checkNonNull (nameof source1) source1 Internal.checkNonNull (nameof source2) source2 @@ -210,7 +210,7 @@ type TaskSeq private () = yield! source2 } - static member prependSeq (source1: seq<'T>) (source2: taskSeq<'T>) = + static member prependSeq (source1: seq<'T>) (source2: TaskSeq<'T>) = Internal.checkNonNull (nameof source1) source1 Internal.checkNonNull (nameof source2) source2 @@ -223,9 +223,9 @@ type TaskSeq private () = // iter/map/collect functions // - static member cast source : taskSeq<'T> = Internal.map (SimpleAction(fun (x: obj) -> x :?> 'T)) source + static member cast source : TaskSeq<'T> = Internal.map (SimpleAction(fun (x: obj) -> x :?> 'T)) source static member box source = Internal.map (SimpleAction box) source - static member unbox<'U when 'U: struct>(source: taskSeq) : taskSeq<'U> = Internal.map (SimpleAction unbox) source + static member unbox<'U when 'U: struct>(source: TaskSeq) : TaskSeq<'U> = Internal.map (SimpleAction unbox) source static member iter action source = Internal.iter (SimpleAction action) source static member iteri action source = Internal.iter (CountableAction action) source static member iterAsync action source = Internal.iter (AsyncSimpleAction action) source @@ -234,10 +234,10 @@ type TaskSeq private () = static member mapi (mapper: int -> 'T -> 'U) source = Internal.map (CountableAction mapper) source static member mapAsync mapper source = Internal.map (AsyncSimpleAction mapper) source static member mapiAsync mapper source = Internal.map (AsyncCountableAction mapper) source - static member collect (binder: 'T -> #taskSeq<'U>) source = Internal.collect binder source + static member collect (binder: 'T -> #TaskSeq<'U>) source = Internal.collect binder source static member collectSeq (binder: 'T -> #seq<'U>) source = Internal.collectSeq binder source - static member collectAsync (binder: 'T -> #Task<#taskSeq<'U>>) source : taskSeq<'U> = Internal.collectAsync binder source - static member collectSeqAsync (binder: 'T -> #Task<#seq<'U>>) source : taskSeq<'U> = Internal.collectSeqAsync binder source + static member collectAsync (binder: 'T -> #Task<#TaskSeq<'U>>) source : TaskSeq<'U> = Internal.collectAsync binder source + static member collectSeqAsync (binder: 'T -> #Task<#seq<'U>>) source : TaskSeq<'U> = Internal.collectSeqAsync binder source // // choosers, pickers and the like @@ -276,7 +276,7 @@ type TaskSeq private () = Internal.tryExactlyOne source |> Task.map (Option.defaultWith (fun () -> invalidArg (nameof source) "The input sequence contains more than one element.")) - static member indexed(source: taskSeq<'T>) = + static member indexed(source: TaskSeq<'T>) = Internal.checkNonNull (nameof source) source taskSeq { diff --git a/src/FSharp.Control.TaskSeq/TaskSeq.fsi b/src/FSharp.Control.TaskSeq/TaskSeq.fsi index 8dc3197c..27d27a25 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeq.fsi +++ b/src/FSharp.Control.TaskSeq/TaskSeq.fsi @@ -9,7 +9,7 @@ open System.Threading.Tasks module TaskSeqExtensions = module TaskSeq = /// Initialize an empty task sequence. - val empty<'T> : taskSeq<'T> + val empty<'T> : TaskSeq<'T> [] type TaskSeq = @@ -19,7 +19,7 @@ type TaskSeq = /// /// /// The input item to use as the single item of the task sequence. - static member singleton: value: 'T -> taskSeq<'T> + static member singleton: value: 'T -> TaskSeq<'T> /// /// Returns if the task sequence contains no elements, otherwise. @@ -27,7 +27,7 @@ type TaskSeq = /// /// The input task sequence. /// Thrown when the input task sequence is null. - static member isEmpty: source: taskSeq<'T> -> Task + static member isEmpty: source: TaskSeq<'T> -> Task /// /// Returns the length of the sequence. This operation requires the whole sequence to be evaluated and @@ -36,7 +36,7 @@ type TaskSeq = /// /// The input task sequence. /// Thrown when the input task sequence is null. - static member length: source: taskSeq<'T> -> Task + static member length: source: TaskSeq<'T> -> Task /// /// Returns the length of the sequence, or , whichever comes first. This operation requires the task sequence @@ -47,7 +47,7 @@ type TaskSeq = /// Limit at which to stop evaluating source items for finding the length. /// The input task sequence. /// Thrown when the input task sequence is null. - static member lengthOrMax: max: int -> source: taskSeq<'T> -> Task + static member lengthOrMax: max: int -> source: TaskSeq<'T> -> Task /// /// Returns the length of the sequence of all items for which the returns true. @@ -58,7 +58,7 @@ type TaskSeq = /// A function to test whether an item in the input sequence should be included in the count. /// The input task sequence. /// Thrown when the input task sequence is null. - static member lengthBy: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task + static member lengthBy: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task /// /// Returns the length of the sequence of all items for which the returns true. @@ -69,7 +69,7 @@ type TaskSeq = /// A function to test whether an item in the input sequence should be included in the count. /// The input task sequence. /// Thrown when the input task sequence is null. - static member lengthByAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task + static member lengthByAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task /// /// Returns a task sequence that is given by the delayed specification of a task sequence. @@ -77,7 +77,7 @@ type TaskSeq = /// /// The generating function for the task sequence. /// The generated task sequence. - static member delay: generator: (unit -> taskSeq<'T>) -> taskSeq<'T> + static member delay: generator: (unit -> TaskSeq<'T>) -> TaskSeq<'T> /// /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function @@ -92,7 +92,7 @@ type TaskSeq = /// A function that generates an item in the sequence from a given index. /// The resulting task sequence. /// Thrown when count is negative. - static member init: count: int -> initializer: (int -> 'T) -> taskSeq<'T> + static member init: count: int -> initializer: (int -> 'T) -> TaskSeq<'T> /// /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function @@ -107,7 +107,7 @@ type TaskSeq = /// A function that generates an item in the sequence from a given index. /// The resulting task sequence. /// Thrown when count is negative. - static member initAsync: count: int -> initializer: (int -> #Task<'T>) -> taskSeq<'T> + static member initAsync: count: int -> initializer: (int -> #Task<'T>) -> TaskSeq<'T> /// /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function @@ -121,7 +121,7 @@ type TaskSeq = /// /// A function that generates an item in the sequence from a given index. /// The resulting task sequence. - static member initInfinite: initializer: (int -> 'T) -> taskSeq<'T> + static member initInfinite: initializer: (int -> 'T) -> TaskSeq<'T> /// /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function @@ -135,7 +135,7 @@ type TaskSeq = /// /// A function that generates an item in the sequence from a given index. /// The resulting task sequence. - static member initInfiniteAsync: initializer: (int -> #Task<'T>) -> taskSeq<'T> + static member initInfiniteAsync: initializer: (int -> #Task<'T>) -> TaskSeq<'T> /// /// Combines the given task sequence of task sequences and concatenates them end-to-end, to form a @@ -145,7 +145,7 @@ type TaskSeq = /// The input task-sequence-of-task-sequences. /// The resulting task sequence. /// Thrown when the input task sequence of task sequences is null. - static member concat: sources: taskSeq<#taskSeq<'T>> -> taskSeq<'T> + static member concat: sources: TaskSeq<#TaskSeq<'T>> -> TaskSeq<'T> /// /// Concatenates task sequences and in order as a single @@ -156,7 +156,7 @@ type TaskSeq = /// The second input task sequence. /// The resulting task sequence. /// Thrown when either of the input task sequences is null. - static member append: source1: taskSeq<'T> -> source2: taskSeq<'T> -> taskSeq<'T> + static member append: source1: TaskSeq<'T> -> source2: TaskSeq<'T> -> TaskSeq<'T> /// /// Concatenates a task sequence with a non-async F# in @@ -167,7 +167,7 @@ type TaskSeq = /// The input F# sequence. /// The resulting task sequence. /// Thrown when either of the input sequences is null. - static member appendSeq: source1: taskSeq<'T> -> source2: seq<'T> -> taskSeq<'T> + static member appendSeq: source1: TaskSeq<'T> -> source2: seq<'T> -> TaskSeq<'T> /// /// Concatenates a non-async F# in with a task sequence in @@ -178,7 +178,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when either of the input sequences is null. - static member prependSeq: source1: seq<'T> -> source2: taskSeq<'T> -> taskSeq<'T> + static member prependSeq: source1: seq<'T> -> source2: TaskSeq<'T> -> TaskSeq<'T> /// /// Builds an F# from the input task sequence in . @@ -188,7 +188,7 @@ type TaskSeq = /// The input task sequence. /// The resulting list. /// Thrown when the input sequence is null. - static member toList: source: taskSeq<'T> -> 'T list + static member toList: source: TaskSeq<'T> -> 'T list /// /// Builds an from the input task sequence in . @@ -198,7 +198,7 @@ type TaskSeq = /// The input task sequence. /// The resulting array. /// Thrown when the input sequence is null. - static member toArray: source: taskSeq<'T> -> 'T[] + static member toArray: source: TaskSeq<'T> -> 'T[] /// /// Views the task sequence in as an F# , that is, an @@ -210,7 +210,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input sequence is null. - static member toSeq: source: taskSeq<'T> -> seq<'T> + static member toSeq: source: TaskSeq<'T> -> seq<'T> /// /// Builds an asynchronously from the input task sequence. @@ -220,7 +220,7 @@ type TaskSeq = /// The input task sequence. /// The resulting array. /// Thrown when the input sequence is null. - static member toArrayAsync: source: taskSeq<'T> -> Task<'T[]> + static member toArrayAsync: source: TaskSeq<'T> -> Task<'T[]> /// /// Builds an F# asynchronously from the input task sequence. @@ -230,7 +230,7 @@ type TaskSeq = /// The input task sequence. /// The resulting list. /// Thrown when the input sequence is null. - static member toListAsync: source: taskSeq<'T> -> Task<'T list> + static member toListAsync: source: TaskSeq<'T> -> Task<'T list> /// /// Gathers items into a ResizeArray (see ) asynchronously from the input task sequence. @@ -240,7 +240,7 @@ type TaskSeq = /// The input task sequence. /// The resulting resizable array. /// Thrown when the input sequence is null. - static member toResizeArrayAsync: source: taskSeq<'T> -> Task> + static member toResizeArrayAsync: source: TaskSeq<'T> -> Task> /// /// Builds an asynchronously from the input task sequence. @@ -250,7 +250,7 @@ type TaskSeq = /// The input task sequence. /// The resulting IList interface. /// Thrown when the input sequence is null. - static member toIListAsync: source: taskSeq<'T> -> Task> + static member toIListAsync: source: TaskSeq<'T> -> Task> /// /// Views the given as a task sequence, that is, as an . @@ -259,7 +259,7 @@ type TaskSeq = /// The input array. /// The resulting task sequence. /// Thrown when the input array is null. - static member ofArray: source: 'T[] -> taskSeq<'T> + static member ofArray: source: 'T[] -> TaskSeq<'T> /// /// Views the given as a task sequence, that is, as an . @@ -267,7 +267,7 @@ type TaskSeq = /// /// The input list. /// The resulting task sequence. - static member ofList: source: 'T list -> taskSeq<'T> + static member ofList: source: 'T list -> TaskSeq<'T> /// /// Views the given as a task sequence, that is, as an . @@ -276,7 +276,7 @@ type TaskSeq = /// The input sequence. /// The resulting task sequence. /// Thrown when the input sequence is null. - static member ofSeq: source: seq<'T> -> taskSeq<'T> + static member ofSeq: source: seq<'T> -> TaskSeq<'T> /// /// Views the given resizable array as a task sequence, that is, as an . @@ -285,7 +285,7 @@ type TaskSeq = /// The input resize array. /// The resulting task sequence. /// Thrown when the input resize array is null. - static member ofResizeArray: source: ResizeArray<'T> -> taskSeq<'T> + static member ofResizeArray: source: ResizeArray<'T> -> TaskSeq<'T> /// /// Views the given of s as a task sequence, that is, as an @@ -298,7 +298,7 @@ type TaskSeq = /// The input sequence-of-tasks. /// The resulting task sequence. /// Thrown when the input sequence is null. - static member ofTaskSeq: source: seq<#Task<'T>> -> taskSeq<'T> + static member ofTaskSeq: source: seq<#Task<'T>> -> TaskSeq<'T> /// /// Views the given of s as a task sequence, that is, as an @@ -311,7 +311,7 @@ type TaskSeq = /// /// The input list-of-tasks. /// The resulting task sequence. - static member ofTaskList: source: #Task<'T> list -> taskSeq<'T> + static member ofTaskList: source: #Task<'T> list -> TaskSeq<'T> /// /// Views the given of s as a task sequence, that is, as an @@ -325,7 +325,7 @@ type TaskSeq = /// The input array-of-tasks. /// The resulting task sequence. /// Thrown when the input array is null. - static member ofTaskArray: source: #Task<'T> array -> taskSeq<'T> + static member ofTaskArray: source: #Task<'T> array -> TaskSeq<'T> /// /// Views the given of s as a task sequence, that is, as an @@ -338,7 +338,7 @@ type TaskSeq = /// The input sequence-of-asyncs. /// The resulting task sequence. /// Thrown when the input sequence is null. - static member ofAsyncSeq: source: seq> -> taskSeq<'T> + static member ofAsyncSeq: source: seq> -> TaskSeq<'T> /// /// Views the given of s as a task sequence, that is, as an @@ -350,7 +350,7 @@ type TaskSeq = /// /// The input list-of-asyncs. /// The resulting task sequence. - static member ofAsyncList: source: Async<'T> list -> taskSeq<'T> + static member ofAsyncList: source: Async<'T> list -> TaskSeq<'T> /// /// Views the given of s as a task sequence, that is, as an @@ -363,7 +363,7 @@ type TaskSeq = /// The input array-of-asyncs. /// The resulting task sequence. /// Thrown when the input sequence is null. - static member ofAsyncArray: source: Async<'T> array -> taskSeq<'T> + static member ofAsyncArray: source: Async<'T> array -> TaskSeq<'T> /// /// Views each item in the input task sequence as , boxing value types. @@ -372,7 +372,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member box: source: taskSeq<'T> -> taskSeq + static member box: source: TaskSeq<'T> -> TaskSeq /// /// Unboxes to the target type each item in the input task sequence. @@ -383,7 +383,7 @@ type TaskSeq = /// The resulting task sequence. /// Thrown when the input task sequence is null. /// Thrown when the function is unable to cast an item to the target type. - static member unbox<'U when 'U: struct> : source: taskSeq -> taskSeq<'U> + static member unbox<'U when 'U: struct> : source: TaskSeq -> TaskSeq<'U> /// /// Casts each item in the untyped input task sequence. If the input sequence contains value types @@ -394,7 +394,7 @@ type TaskSeq = /// The resulting task sequence. /// Thrown when the input task sequence is null. /// Thrown when the function is unable to cast an item to the target type. - static member cast: source: taskSeq -> taskSeq<'U> + static member cast: source: TaskSeq -> TaskSeq<'U> /// /// Iterates over the input task sequence, applying the function to each item. @@ -405,7 +405,7 @@ type TaskSeq = /// The input task sequence. /// A . /// Thrown when the input sequence is null. - static member iter: action: ('T -> unit) -> source: taskSeq<'T> -> Task + static member iter: action: ('T -> unit) -> source: TaskSeq<'T> -> Task /// /// Iterates over the input task sequence, applying the function to each item, @@ -417,7 +417,7 @@ type TaskSeq = /// The input task sequence. /// A . /// Thrown when the input task sequence is null. - static member iteri: action: (int -> 'T -> unit) -> source: taskSeq<'T> -> Task + static member iteri: action: (int -> 'T -> unit) -> source: TaskSeq<'T> -> Task /// /// Iterates over the input task sequence, applying the asynchronous function to each item. @@ -428,7 +428,7 @@ type TaskSeq = /// The input task sequence. /// A . /// Thrown when the input task sequence is null. - static member iterAsync: action: ('T -> #Task) -> source: taskSeq<'T> -> Task + static member iterAsync: action: ('T -> #Task) -> source: TaskSeq<'T> -> Task /// /// Iterates over the input task sequence, applying the asynchronous function to each item, @@ -440,7 +440,7 @@ type TaskSeq = /// The input task sequence. /// A . /// Thrown when the input sequence is null. - static member iteriAsync: action: (int -> 'T -> #Task) -> source: taskSeq<'T> -> Task + static member iteriAsync: action: (int -> 'T -> #Task) -> source: TaskSeq<'T> -> Task /// /// Builds a new task sequence whose elements are the corresponding elements of the input task @@ -451,7 +451,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence of tuples. /// Thrown when the input task sequence is null. - static member indexed: source: taskSeq<'T> -> taskSeq + static member indexed: source: TaskSeq<'T> -> TaskSeq /// /// Builds a new task sequence whose elements are the results of applying the @@ -465,7 +465,7 @@ type TaskSeq = /// 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> + static member map: mapper: ('T -> 'U) -> source: TaskSeq<'T> -> TaskSeq<'U> /// /// Builds a new task sequence whose elements are the results of applying the @@ -480,7 +480,7 @@ type TaskSeq = /// 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> + 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 @@ -494,7 +494,7 @@ type TaskSeq = /// 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> + 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 @@ -509,7 +509,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member mapiAsync: mapper: (int -> 'T -> #Task<'U>) -> source: taskSeq<'T> -> taskSeq<'U> + static member mapiAsync: mapper: (int -> 'T -> #Task<'U>) -> source: TaskSeq<'T> -> TaskSeq<'U> /// /// Builds a new task sequence whose elements are the results of applying the @@ -524,7 +524,7 @@ type TaskSeq = /// The input task sequence. /// The resulting concatenation of all returned task sequences. /// Thrown when the input task sequence is null. - static member collect: binder: ('T -> #taskSeq<'U>) -> source: taskSeq<'T> -> taskSeq<'U> + static member collect: binder: ('T -> #TaskSeq<'U>) -> source: TaskSeq<'T> -> TaskSeq<'U> /// /// Builds a new task sequence whose elements are the results of applying the @@ -539,7 +539,7 @@ type TaskSeq = /// The input task sequence. /// The resulting concatenation of all returned task sequences. /// Thrown when the input task sequence is null. - static member collectSeq: binder: ('T -> #seq<'U>) -> source: taskSeq<'T> -> taskSeq<'U> + static member collectSeq: binder: ('T -> #seq<'U>) -> source: TaskSeq<'T> -> TaskSeq<'U> /// /// Builds a new task sequence whose elements are the results of applying the asynchronous @@ -555,7 +555,7 @@ type TaskSeq = /// The resulting concatenation of all returned task sequences. /// Thrown when the input task sequence is null. static member collectAsync: - binder: ('T -> #Task<'TSeqU>) -> source: taskSeq<'T> -> taskSeq<'U> when 'TSeqU :> taskSeq<'U> + binder: ('T -> #Task<'TSeqU>) -> source: TaskSeq<'T> -> TaskSeq<'U> when 'TSeqU :> TaskSeq<'U> /// /// Builds a new task sequence whose elements are the results of applying the asynchronous @@ -571,7 +571,7 @@ type TaskSeq = /// The resulting concatenation of all returned task sequences. /// Thrown when the input task sequence is null. static member collectSeqAsync: - binder: ('T -> #Task<'SeqU>) -> source: taskSeq<'T> -> taskSeq<'U> when 'SeqU :> seq<'U> + binder: ('T -> #Task<'SeqU>) -> source: TaskSeq<'T> -> TaskSeq<'U> when 'SeqU :> seq<'U> /// /// Returns the first element of the input task sequence given by , @@ -581,7 +581,7 @@ type TaskSeq = /// The input task sequence. /// The first element of the task sequence, or . /// Thrown when the input task sequence is null. - static member tryHead: source: taskSeq<'T> -> Task<'T option> + static member tryHead: source: TaskSeq<'T> -> Task<'T option> /// /// Returns the first element of the input task sequence given by . @@ -591,7 +591,7 @@ type TaskSeq = /// The first element of the task sequence. /// Thrown when the input task sequence is null. /// Thrown when the task sequence is empty. - static member head: source: taskSeq<'T> -> Task<'T> + static member head: source: TaskSeq<'T> -> Task<'T> /// /// Returns the whole input task sequence given by , minus its first element, @@ -601,7 +601,7 @@ type TaskSeq = /// The input task sequence. /// The input task sequence minus the first element, or . /// Thrown when the input task sequence is null. - static member tryTail: source: taskSeq<'T> -> Task option> + static member tryTail: source: TaskSeq<'T> -> Task option> /// /// Returns the whole task sequence from , minus its first element. @@ -611,7 +611,7 @@ type TaskSeq = /// The input task sequence minus the first element. /// Thrown when the input task sequence is null. /// Thrown when the task sequence is empty. - static member tail: source: taskSeq<'T> -> Task> + static member tail: source: TaskSeq<'T> -> Task> /// /// Returns the last element of the input task sequence given by , @@ -621,7 +621,7 @@ type TaskSeq = /// The input task sequence. /// The last element of the task sequence, or None. /// Thrown when the input task sequence is null. - static member tryLast: source: taskSeq<'T> -> Task<'T option> + static member tryLast: source: TaskSeq<'T> -> Task<'T option> /// /// Returns the last element of the input task sequence given by . @@ -631,7 +631,7 @@ type TaskSeq = /// The last element of the task sequence. /// Thrown when the input task sequence is null. /// Thrown when the task sequence is empty. - static member last: source: taskSeq<'T> -> Task<'T> + static member last: source: TaskSeq<'T> -> Task<'T> /// /// Returns the nth element of the input task sequence given by , @@ -642,7 +642,7 @@ type TaskSeq = /// The input task sequence. /// 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> + static member tryItem: index: int -> source: TaskSeq<'T> -> Task<'T option> /// /// Returns the nth element of the input task sequence given by , @@ -654,7 +654,7 @@ type TaskSeq = /// 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. - static member item: index: int -> source: taskSeq<'T> -> Task<'T> + static member item: index: int -> source: TaskSeq<'T> -> Task<'T> /// /// Returns the only element of the task sequence, or if the sequence is empty of @@ -664,7 +664,7 @@ type TaskSeq = /// The input task sequence. /// The only element of the singleton task sequence, or . /// Thrown when the input task sequence is null. - static member tryExactlyOne: source: taskSeq<'T> -> Task<'T option> + static member tryExactlyOne: source: TaskSeq<'T> -> Task<'T option> /// /// Returns the only element of the task sequence. @@ -674,7 +674,7 @@ type TaskSeq = /// The only element of the singleton task sequence, or . /// Thrown when the input task sequence is null. /// Thrown when the input task sequence does not contain precisely one element. - static member exactlyOne: source: taskSeq<'T> -> Task<'T> + static member exactlyOne: source: TaskSeq<'T> -> Task<'T> /// /// Applies the given function to each element of the task sequence. Returns @@ -686,7 +686,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member choose: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> taskSeq<'U> + static member choose: chooser: ('T -> 'U option) -> source: TaskSeq<'T> -> TaskSeq<'U> /// /// Applies the given asynchronous function to each element of the task sequence. @@ -699,7 +699,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member chooseAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> taskSeq<'U> + static member chooseAsync: chooser: ('T -> #Task<'U option>) -> source: TaskSeq<'T> -> TaskSeq<'U> /// /// Returns a new task sequence containing only the elements of the collection @@ -711,7 +711,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member filter: predicate: ('T -> bool) -> source: taskSeq<'T> -> taskSeq<'T> + static member filter: predicate: ('T -> bool) -> source: TaskSeq<'T> -> TaskSeq<'T> /// /// Returns a new task sequence containing only the elements of the input sequence @@ -723,7 +723,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member filterAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> taskSeq<'T> + static member filterAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> TaskSeq<'T> /// /// Returns a task sequence that, when iterated, yields elements of the underlying sequence while the @@ -737,7 +737,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member takeWhile: predicate: ('T -> bool) -> source: taskSeq<'T> -> taskSeq<'T> + static member takeWhile: predicate: ('T -> bool) -> source: TaskSeq<'T> -> TaskSeq<'T> /// /// Returns a sequence that, when iterated, yields elements of the underlying sequence while the @@ -751,7 +751,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member takeWhileAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> taskSeq<'T> + static member takeWhileAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> TaskSeq<'T> /// /// Returns a sequence that, when iterated, yields elements of the underlying sequence until the given @@ -765,7 +765,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member takeWhileInclusive: predicate: ('T -> bool) -> source: taskSeq<'T> -> taskSeq<'T> + static member takeWhileInclusive: predicate: ('T -> bool) -> source: TaskSeq<'T> -> TaskSeq<'T> /// /// Returns a sequence that, when iterated, yields elements of the underlying sequence until the given @@ -779,7 +779,7 @@ type TaskSeq = /// The input task sequence. /// The resulting task sequence. /// Thrown when the input task sequence is null. - static member takeWhileInclusiveAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> taskSeq<'T> + static member takeWhileInclusiveAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> TaskSeq<'T> /// /// Applies the given function to successive elements, returning the first result where @@ -790,7 +790,7 @@ type TaskSeq = /// The input task sequence. /// The chosen element or . /// Thrown when the input task sequence is null. - static member tryPick: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> Task<'U option> + static member tryPick: chooser: ('T -> 'U option) -> source: TaskSeq<'T> -> Task<'U option> /// /// Applies the given asynchronous function to successive elements, returning the first result where @@ -801,7 +801,7 @@ type TaskSeq = /// The input task sequence. /// The chosen element or . /// Thrown when the input task sequence is null. - static member tryPickAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> Task<'U option> + static member tryPickAsync: chooser: ('T -> #Task<'U option>) -> source: TaskSeq<'T> -> Task<'U option> /// /// Returns the first element for which the given function returns @@ -813,7 +813,7 @@ type TaskSeq = /// The input task sequence. /// The found element or . /// Thrown when the input task sequence is null. - static member tryFind: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task<'T option> + static member tryFind: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task<'T option> /// /// Returns the first element for which the given asynchronous function returns @@ -825,7 +825,7 @@ type TaskSeq = /// The input task sequence. /// The found element or . /// Thrown when the input task sequence is null. - static member tryFindAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task<'T option> + static member tryFindAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task<'T option> /// /// Returns the index, starting from zero, for which the given function returns @@ -837,7 +837,7 @@ type TaskSeq = /// The input task sequence. /// The found element or . /// Thrown when the input task sequence is null. - static member tryFindIndex: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task + static member tryFindIndex: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task /// /// Returns the index, starting from zero, for which the given asynchronous function returns @@ -849,7 +849,7 @@ type TaskSeq = /// The input task sequence. /// The found element or . /// Thrown when the input task sequence is null. - static member tryFindIndexAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task + static member tryFindIndexAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task /// /// Applies the given function to successive elements, returning the first result where @@ -862,7 +862,7 @@ type TaskSeq = /// The selected element. /// Thrown when the input task sequence is null. /// Thrown when every item of the sequence evaluates to when the given function is applied. - static member pick: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> Task<'U> + static member pick: chooser: ('T -> 'U option) -> source: TaskSeq<'T> -> Task<'U> /// /// Applies the given asynchronous function to successive elements, returning the first result where @@ -875,7 +875,7 @@ type TaskSeq = /// The selected element. /// Thrown when the input task sequence is null. /// Thrown when every item of the sequence evaluates to when the given function is applied. - static member pickAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> Task<'U> + static member pickAsync: chooser: ('T -> #Task<'U option>) -> source: TaskSeq<'T> -> Task<'U> /// /// Returns the first element for which the given function returns . @@ -888,7 +888,7 @@ type TaskSeq = /// The first element for which the predicate returns . /// Thrown when the input task sequence is null. /// Thrown if no element returns when evaluated by the function. - static member find: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task<'T> + static member find: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task<'T> /// /// Returns the first element for which the given asynchronous function returns . @@ -901,7 +901,7 @@ type TaskSeq = /// The first element for which the predicate returns . /// Thrown when the input task sequence is null. /// Thrown if no element returns when evaluated by the function. - static member findAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task<'T> + static member findAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task<'T> /// /// Returns the index, starting from zero, of the first element for which the given function @@ -914,7 +914,7 @@ type TaskSeq = /// The index for which the predicate returns . /// Thrown when the input task sequence is null. /// Thrown if no element returns when evaluated by the function. - static member findIndex: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task + static member findIndex: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task /// /// Returns the index, starting from zero, of the first element for which the given function @@ -927,7 +927,7 @@ type TaskSeq = /// The index for which the predicate returns . /// Thrown when the input task sequence is null. /// Thrown if no element returns when evaluated by the function. - static member findIndexAsync: predicate: ('T -> #Task) -> source: taskSeq<'T> -> Task + static member findIndexAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task /// /// Tests if the sequence contains the specified element. Returns @@ -939,7 +939,7 @@ type TaskSeq = /// The input task sequence. /// 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 + static member contains<'T when 'T: equality> : value: 'T -> source: TaskSeq<'T> -> Task /// /// Tests if any element of the task sequence in satisfies the given . The function @@ -952,7 +952,7 @@ type TaskSeq = /// The input task sequence. /// 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 + static member exists: predicate: ('T -> bool) -> source: TaskSeq<'T> -> Task /// /// Tests if any element of the task sequence in satisfies the given asynchronous . @@ -965,7 +965,7 @@ type TaskSeq = /// The input task sequence. /// 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 + static member existsAsync: predicate: ('T -> #Task) -> source: TaskSeq<'T> -> Task /// /// Returns a new task sequence with the distinct elements of the second task sequence which do not appear in the @@ -984,7 +984,7 @@ type TaskSeq = /// A sequence that contains the set difference of the elements of two sequences. /// /// Thrown when either of the two input task sequences is null. - static member except<'T when 'T: equality> : itemsToExclude: taskSeq<'T> -> source: taskSeq<'T> -> taskSeq<'T> + static member except<'T when 'T: equality> : itemsToExclude: TaskSeq<'T> -> source: TaskSeq<'T> -> TaskSeq<'T> /// /// Returns a new task sequence with the distinct elements of the second task sequence which do not appear in the @@ -1003,7 +1003,7 @@ type TaskSeq = /// A sequence that contains the set difference of the elements of two sequences. /// /// Thrown when either of the two input task sequences is null. - static member exceptOfSeq<'T when 'T: equality> : itemsToExclude: seq<'T> -> source: taskSeq<'T> -> taskSeq<'T> + static member exceptOfSeq<'T when 'T: equality> : itemsToExclude: seq<'T> -> source: TaskSeq<'T> -> TaskSeq<'T> /// /// Combines the two task sequences into a new task sequence of pairs. The two sequences need not have equal lengths: @@ -1013,7 +1013,7 @@ type TaskSeq = /// The first input task sequence. /// The second input task sequence. /// Thrown when either of the two input task sequences is null. - static member zip: source1: taskSeq<'T> -> source2: taskSeq<'U> -> taskSeq<'T * 'U> + static member zip: source1: TaskSeq<'T> -> source2: TaskSeq<'U> -> TaskSeq<'T * 'U> /// /// Applies the function to each element in the task sequence, threading an accumulator @@ -1027,7 +1027,7 @@ type TaskSeq = /// The input sequence. /// The state object after the folding function is applied to each element of the sequence. /// Thrown when the input task sequence is null. - static member fold: folder: ('State -> 'T -> 'State) -> state: 'State -> source: taskSeq<'T> -> Task<'State> + static member fold: folder: ('State -> 'T -> 'State) -> state: 'State -> source: TaskSeq<'T> -> Task<'State> /// /// Applies the asynchronous function to each element in the task sequence, threading an accumulator @@ -1042,4 +1042,4 @@ type TaskSeq = /// The state object after the folding function is applied to each element of the sequence. /// Thrown when the input task sequence is null. static member foldAsync: - folder: ('State -> 'T -> #Task<'State>) -> state: 'State -> source: taskSeq<'T> -> Task<'State> + folder: ('State -> 'T -> #Task<'State>) -> state: 'State -> source: TaskSeq<'T> -> Task<'State> diff --git a/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fs b/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fs index a61d72d1..87e3dbcc 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fs +++ b/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fs @@ -41,8 +41,12 @@ module Internal = // cannot be marked with 'internal' scope NotImplementedException "Abstract Class: method or property not implemented" |> raise +// deprecated from 0.4.0, see FSI file type taskSeq<'T> = IAsyncEnumerable<'T> +// the proper type from 0.4.0 onwards, see FSI file +type TaskSeq<'T> = IAsyncEnumerable<'T> + [] type TaskSeqStateMachineData<'T>() = diff --git a/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fsi b/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fsi index 420353c4..90ea40e2 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fsi +++ b/src/FSharp.Control.TaskSeq/TaskSeqBuilder.fsi @@ -25,10 +25,18 @@ module Internal = val inline raiseNotImpl: unit -> 'a /// -/// Result of any computation expression, alias for . +/// The type is deprecated since version 0.4.0, +/// please use in its stead. See . /// +[' is deprecated in favor of 'TaskSeq<_>'. It will be removed in an upcoming release.">] type taskSeq<'T> = IAsyncEnumerable<'T> +/// +/// Represents a and is the output of using the +/// computation expression from this library. It is an alias for . +/// +type TaskSeq<'T> = IAsyncEnumerable<'T> + /// TaskSeqCode type alias of ResumableCode delegate type, specially recognized by the F# compiler and ResumableTSC<'T> = ResumableCode, unit> @@ -130,7 +138,7 @@ type TaskSeqBuilder = member inline Combine: task1: ResumableTSC<'T> * task2: ResumableTSC<'T> -> ResumableTSC<'T> member inline Delay: f: (unit -> ResumableTSC<'T>) -> ResumableTSC<'T> - member inline Run: code: ResumableTSC<'T> -> taskSeq<'T> + member inline Run: code: ResumableTSC<'T> -> TaskSeq<'T> member inline TryFinally: body: ResumableTSC<'T> * compensationAction: (unit -> unit) -> ResumableTSC<'T> member inline TryFinallyAsync: body: ResumableTSC<'T> * compensationAction: (unit -> Task) -> ResumableTSC<'T> member inline TryWith: body: ResumableTSC<'T> * catch: (exn -> ResumableTSC<'T>) -> ResumableTSC<'T> @@ -184,8 +192,8 @@ module MediumPriority = member inline For: sequence: seq<'TElement> * body: ('TElement -> ResumableTSC<'T>) -> ResumableTSC<'T> member inline YieldFrom: source: seq<'T> -> ResumableTSC<'T> - member inline For: source: #taskSeq<'TElement> * body: ('TElement -> ResumableTSC<'T>) -> ResumableTSC<'T> - member inline YieldFrom: source: taskSeq<'T> -> ResumableTSC<'T> + member inline For: source: #TaskSeq<'TElement> * body: ('TElement -> ResumableTSC<'T>) -> ResumableTSC<'T> + member inline YieldFrom: source: TaskSeq<'T> -> ResumableTSC<'T> /// /// Contains low priority extension methods for the main builder class for the computation expression. diff --git a/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs b/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs index 97712620..9594caf9 100644 --- a/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs +++ b/src/FSharp.Control.TaskSeq/TaskSeqInternal.fs @@ -67,7 +67,7 @@ module internal TaskSeqInternal = KeyNotFoundException("The predicate function or index did not satisfy any item in the async sequence.") |> raise - let isEmpty (source: taskSeq<_>) = + let isEmpty (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -102,7 +102,7 @@ module internal TaskSeqInternal = } /// Returns length unconditionally, or based on a predicate - let lengthBy predicate (source: taskSeq<_>) = + let lengthBy predicate (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -141,7 +141,7 @@ module internal TaskSeqInternal = } /// Returns length unconditionally, or based on a predicate - let lengthBeforeMax max (source: taskSeq<_>) = + let lengthBeforeMax max (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -160,7 +160,7 @@ module internal TaskSeqInternal = return i } - let tryExactlyOne (source: taskSeq<_>) = + let tryExactlyOne (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -219,7 +219,7 @@ module internal TaskSeqInternal = } - let iter action (source: taskSeq<_>) = + let iter action (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -263,7 +263,7 @@ module internal TaskSeqInternal = go <- step } - let fold folder initial (source: taskSeq<_>) = + let fold folder initial (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -301,7 +301,7 @@ module internal TaskSeqInternal = let toResizeArrayAndMapAsync mapper source = (toResizeArrayAsync >> Task.map mapper) source - let map mapper (source: taskSeq<_>) = + let map mapper (source: TaskSeq<_>) = checkNonNull (nameof source) source match mapper with @@ -333,7 +333,7 @@ module internal TaskSeqInternal = yield result } - let zip (source1: taskSeq<_>) (source2: taskSeq<_>) = + let zip (source1: TaskSeq<_>) (source2: TaskSeq<_>) = checkNonNull (nameof source1) source1 checkNonNull (nameof source2) source2 @@ -352,7 +352,7 @@ module internal TaskSeqInternal = go <- step1 && step2 } - let collect (binder: _ -> #IAsyncEnumerable<_>) (source: taskSeq<_>) = + let collect (binder: _ -> #IAsyncEnumerable<_>) (source: TaskSeq<_>) = checkNonNull (nameof source) source taskSeq { @@ -360,7 +360,7 @@ module internal TaskSeqInternal = yield! binder c :> IAsyncEnumerable<_> } - let collectSeq (binder: _ -> #seq<_>) (source: taskSeq<_>) = + let collectSeq (binder: _ -> #seq<_>) (source: TaskSeq<_>) = checkNonNull (nameof source) source taskSeq { @@ -368,7 +368,7 @@ module internal TaskSeqInternal = yield! binder c :> seq<_> } - let collectAsync (binder: _ -> #Task<#IAsyncEnumerable<_>>) (source: taskSeq<_>) = + let collectAsync (binder: _ -> #Task<#IAsyncEnumerable<_>>) (source: TaskSeq<_>) = checkNonNull (nameof source) source taskSeq { @@ -377,7 +377,7 @@ module internal TaskSeqInternal = yield! result :> IAsyncEnumerable<_> } - let collectSeqAsync (binder: _ -> #Task<#seq<_>>) (source: taskSeq<_>) = + let collectSeqAsync (binder: _ -> #Task<#seq<_>>) (source: TaskSeq<_>) = checkNonNull (nameof source) source taskSeq { @@ -386,7 +386,7 @@ module internal TaskSeqInternal = yield! result :> seq<_> } - let tryLast (source: taskSeq<_>) = + let tryLast (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -406,7 +406,7 @@ module internal TaskSeqInternal = | ValueNone -> return None } - let tryHead (source: taskSeq<_>) = + let tryHead (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -417,7 +417,7 @@ module internal TaskSeqInternal = | false -> return None } - let tryTail (source: taskSeq<_>) = + let tryTail (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -440,7 +440,7 @@ module internal TaskSeqInternal = |> Some } - let tryItem index (source: taskSeq<_>) = + let tryItem index (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -468,7 +468,7 @@ module internal TaskSeqInternal = return foundItem } - let tryPick chooser (source: taskSeq<_>) = + let tryPick chooser (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -503,7 +503,7 @@ module internal TaskSeqInternal = return foundItem } - let tryFind predicate (source: taskSeq<_>) = + let tryFind predicate (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -542,7 +542,7 @@ module internal TaskSeqInternal = return foundItem } - let tryFindIndex predicate (source: taskSeq<_>) = + let tryFindIndex predicate (source: TaskSeq<_>) = checkNonNull (nameof source) source task { @@ -577,7 +577,7 @@ module internal TaskSeqInternal = if isFound then return Some index else return None } - let choose chooser (source: taskSeq<_>) = + let choose chooser (source: TaskSeq<_>) = checkNonNull (nameof source) source taskSeq { @@ -596,7 +596,7 @@ module internal TaskSeqInternal = | None -> () } - let filter predicate (source: taskSeq<_>) = + let filter predicate (source: TaskSeq<_>) = checkNonNull (nameof source) source taskSeq { @@ -613,7 +613,7 @@ module internal TaskSeqInternal = | false -> () } - let takeWhile whileKind predicate (source: taskSeq<_>) = + let takeWhile whileKind predicate (source: TaskSeq<_>) = checkNonNull (nameof source) source taskSeq { @@ -691,7 +691,7 @@ module internal TaskSeqInternal = finally _rwLock.ExitWriteLock() - member _.AddManyAsync(source: taskSeq<'T>) = task { + member _.AddManyAsync(source: TaskSeq<'T>) = task { use e = source.GetAsyncEnumerator(ct) let mutable go = true let! step = e.MoveNextAsync() @@ -720,7 +720,7 @@ module internal TaskSeqInternal = ValueTask.CompletedTask - let except itemsToExclude (source: taskSeq<_>) = + let except itemsToExclude (source: TaskSeq<_>) = checkNonNull (nameof source) source checkNonNull (nameof itemsToExclude) itemsToExclude @@ -748,7 +748,7 @@ module internal TaskSeqInternal = } - let exceptOfSeq itemsToExclude (source: taskSeq<_>) = + let exceptOfSeq itemsToExclude (source: TaskSeq<_>) = checkNonNull (nameof source) source checkNonNull (nameof itemsToExclude) itemsToExclude