From 1bb1c3c930c0dc015d86172c1bdbe7992a15ddcb Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 6 Apr 2023 13:11:38 +0200 Subject: [PATCH] Unignore files for formatting (.fantomasignore) if the underlying Fantomas issue has been resolved (#14960) * SI.fs fantomas'd * unignore .fsi files in Fsharp.Core * Removing commented out files from fantomasignore * Automated command ran: fantomas Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .fantomasignore | 8 - src/FSharp.Core/SI.fs | 60 ++--- src/FSharp.Core/array.fsi | 539 +++++++++++++++++++------------------- src/FSharp.Core/seq.fsi | 265 ++++++++++--------- src/FSharp.Core/tasks.fsi | 471 ++++++++++++++++----------------- 5 files changed, 671 insertions(+), 672 deletions(-) diff --git a/.fantomasignore b/.fantomasignore index 5abcb43bf..0bec7ed14 100644 --- a/.fantomasignore +++ b/.fantomasignore @@ -107,9 +107,6 @@ src/FSharp.Core/printf.fs src/FSharp.Core/Query.fs src/FSharp.Core/seqcore.fs -# Fantomas limitation https://github.com/fsprojects/fantomas/issues/2264 - -src/FSharp.Core/SI.fs # Fantomas limitations on implementation files (to investigate) @@ -139,8 +136,3 @@ src/FSharp.Core/Query.fsi src/FSharp.Core/resumable.fsi src/FSharp.Core/async.fsi -# Fantomas limitations on signature files in FSharp.Core (https://github.com/fsprojects/fantomas/issues/2230) - -src/FSharp.Core/array.fsi -src/FSharp.Core/tasks.fsi -src/FSharp.Core/seq.fsi diff --git a/src/FSharp.Core/SI.fs b/src/FSharp.Core/SI.fs index bf88a6300..5f94c6650 100644 --- a/src/FSharp.Core/SI.fs +++ b/src/FSharp.Core/SI.fs @@ -7,11 +7,11 @@ open Microsoft.FSharp.Core /// The SI unit of length [] -type metre +type metre /// The SI unit of length [] -type meter = metre +type meter = metre /// The SI unit of mass [] @@ -23,11 +23,11 @@ type second /// The SI unit of electric current [] -type ampere +type ampere /// The SI unit of thermodynamic temperature [] -type kelvin +type kelvin /// The SI unit of amount of substance [] @@ -35,7 +35,7 @@ type mole /// The SI unit of luminous intensity [] -type candela +type candela /// The SI unit of frequency [] @@ -43,7 +43,7 @@ type hertz = / second /// The SI unit of force [] -type newton = kilogram metre / second^2 +type newton = kilogram metre / second^2 /// The SI unit of pressure, stress [] @@ -55,63 +55,63 @@ type joule = newton metre /// The SI unit of power, radiant flux [] -type watt = joule / second +type watt = joule / second /// The SI unit of electric charge, amount of electricity [] -type coulomb = second ampere +type coulomb = second ampere /// The SI unit of electric potential difference, electromotive force [] -type volt = watt/ampere +type volt = watt / ampere /// The SI unit of capacitance [] -type farad = coulomb/volt +type farad = coulomb / volt /// The SI unit of electric resistance [] -type ohm = volt/ampere +type ohm = volt / ampere /// The SI unit of electric conductance [] -type siemens = ampere/volt +type siemens = ampere / volt /// The SI unit of magnetic flux [] -type weber = volt second +type weber = volt second /// The SI unit of magnetic flux density [] -type tesla = weber/metre^2 +type tesla = weber / metre^2 /// The SI unit of inductance [] -type henry = weber/ampere +type henry = weber / ampere /// The SI unit of luminous flux [] -type lumen = candela +type lumen = candela /// The SI unit of illuminance [] -type lux = lumen/metre^2 +type lux = lumen / metre^2 /// The SI unit of activity referred to a radionuclide [] -type becquerel = second^-1 +type becquerel = second^-1 /// The SI unit of absorbed dose [] -type gray = joule/kilogram +type gray = joule / kilogram /// The SI unit of does equivalent [] -type sievert = joule/kilogram +type sievert = joule / kilogram /// The SI unit of catalytic activity [] -type katal = mole/second +type katal = mole / second // Common abbreviations for the International System of Units (SI) namespace Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols @@ -121,7 +121,7 @@ open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames /// A synonym for Metre, the SI unit of length [] -type m = metre +type m = metre /// A synonym for kilogram, the SI unit of mass [] @@ -133,19 +133,19 @@ type s = second /// A synonym for ampere, the SI unit of electric current [] -type A = ampere +type A = ampere /// A synonym for kelvin, the SI unit of thermodynamic temperature [] -type K = kelvin +type K = kelvin /// A synonym for mole, the SI unit of amount of substance [] -type mol = mole +type mol = mole /// A synonym for candela, the SI unit of luminous intensity [] -type cd = candela +type cd = candela /// A synonym for hertz, the SI unit of frequency [] @@ -165,11 +165,11 @@ type J = joule /// A synonym for watt, the SI unit of power, radiant flux [] -type W = watt +type W = watt /// A synonym for coulomb, the SI unit of electric charge, amount of electricity [] -type C = coulomb +type C = coulomb /// A synonym for volt, the SI unit of electric potential difference, electromotive force [] @@ -181,11 +181,11 @@ type F = farad /// A synonym for siemens, the SI unit of electric conductance [] -type S = siemens +type S = siemens /// A synonym for UnitNames.ohm, the SI unit of electric resistance. [] -type ohm = Microsoft.FSharp.Data.UnitSystems.SI.UnitNames.ohm +type ohm = Microsoft.FSharp.Data.UnitSystems.SI.UnitNames.ohm /// A synonym for weber, the SI unit of magnetic flux [] diff --git a/src/FSharp.Core/array.fsi b/src/FSharp.Core/array.fsi index 2e34d39c2..ec0d228a3 100644 --- a/src/FSharp.Core/array.fsi +++ b/src/FSharp.Core/array.fsi @@ -14,7 +14,7 @@ open System.Collections.Generic /// [] [] -module Array = +module Array = /// Returns a new array that contains all pairings of elements from the first and second arrays. /// @@ -35,7 +35,7 @@ module Array = /// /// [] - val allPairs: array1:'T1[] -> array2:'T2[] -> ('T1 * 'T2)[] + val allPairs: array1: 'T1[] -> array2: 'T2[] -> ('T1 * 'T2)[] /// Builds a new array that contains the elements of the first array followed by the elements of the second array. /// @@ -53,7 +53,7 @@ module Array = /// Evaluates to [| 1; 2; 3; 4 |]. /// [] - val append: array1:'T[] -> array2:'T[] -> 'T[] + val append: array1: 'T[] -> array2: 'T[] -> 'T[] /// Returns the average of the elements in the array. /// @@ -78,10 +78,11 @@ module Array = /// Throws ArgumentException /// [] - val inline average : array:^T[] -> ^T - when ^T : (static member ( + ) : ^T * ^T -> ^T) - and ^T : (static member DivideByInt : ^T*int -> ^T) - and ^T : (static member Zero : ^T) + val inline average: + array: ^T[] -> ^T + when ^T: (static member (+): ^T * ^T -> ^T) + and ^T: (static member DivideByInt: ^T * int -> ^T) + and ^T: (static member Zero: ^T) /// Returns the average of the elements generated by applying the function to each element of the array. /// @@ -116,11 +117,12 @@ module Array = /// Throws ArgumentException /// [] - val inline averageBy : projection:('T -> ^U) -> array:'T[] -> ^U - when ^U : (static member ( + ) : ^U * ^U -> ^U) - and ^U : (static member DivideByInt : ^U*int -> ^U) - and ^U : (static member Zero : ^U) - + val inline averageBy: + projection: ('T -> ^U) -> array: 'T[] -> ^U + when ^U: (static member (+): ^U * ^U -> ^U) + and ^U: (static member DivideByInt: ^U * int -> ^U) + and ^U: (static member Zero: ^U) + /// Reads a range of elements from the first array and write them into the second. /// /// The source array. @@ -152,8 +154,8 @@ module Array = /// After evaluation target contains [| 0; 1; 2; 13; 14; 5 |]. /// [] - val inline blit: source:'T[] -> sourceIndex:int -> target:'T[] -> targetIndex:int -> count:int -> unit - + val inline blit: source: 'T[] -> sourceIndex: int -> target: 'T[] -> targetIndex: int -> count: int -> unit + /// For each element of the array, applies the given function. Concatenates all the results and return the combined array. /// /// The function to create sub-arrays from the input array elements. @@ -183,7 +185,7 @@ module Array = /// Evaluates to [| 1; 2; 3; 4 |] /// [] - val collect : mapping:('T -> 'U[]) -> array:'T[] -> 'U[] + val collect: mapping: ('T -> 'U[]) -> array: 'T[] -> 'U[] /// Compares two arrays using the given comparison function, element by element. /// @@ -192,10 +194,10 @@ module Array = /// The first input array. /// The second input array. /// - /// Returns the first non-zero result from the comparison function. If the first array has - /// a larger element, the return value is always positive. If the second array has a larger - /// element, the return value is always negative. When the elements are equal in the two - /// arrays, 1 is returned if the first array is longer, 0 is returned if they are equal in + /// Returns the first non-zero result from the comparison function. If the first array has + /// a larger element, the return value is always positive. If the second array has a larger + /// element, the return value is always negative. When the elements are equal in the two + /// arrays, 1 is returned if the first array is longer, 0 is returned if they are equal in /// length, and -1 is returned when the second array is longer. /// /// Thrown when either of the input arrays @@ -266,7 +268,7 @@ module Array = /// Evaluates to -1 /// [] - val inline compareWith: comparer:('T -> 'T -> int) -> array1:'T[] -> array2:'T[] -> int + val inline compareWith: comparer: ('T -> 'T -> int) -> array1: 'T[] -> array2: 'T[] -> int /// Builds a new array that contains the elements of each of the given sequence of arrays. /// @@ -285,8 +287,8 @@ module Array = /// Evaluates to [| 1; 2; 3; 4; 5 |] /// [] - val concat: arrays:seq<'T[]> -> 'T[] - + val concat: arrays: seq<'T[]> -> 'T[] + /// Tests if the array contains the specified element. /// /// The value to locate in the input array. @@ -303,7 +305,7 @@ module Array = /// /// [] - val inline contains: value:'T -> array:'T[] -> bool when 'T : equality + val inline contains: value: 'T -> array: 'T[] -> bool when 'T: equality /// Builds a new array that contains the elements of the given array. /// @@ -322,7 +324,7 @@ module Array = /// Evaluates to a new array containing[| 12; 13; 14 |]. /// [] - val copy: array:'T[] -> 'T[] + val copy: array: 'T[] -> 'T[] /// Applies a key-generating function to each element of an array and returns an array yielding unique /// keys and their number of occurrences in the original array. @@ -346,7 +348,7 @@ module Array = /// Evaluates to [| ("a", 2); ("b", 1) |] /// [] - val countBy : projection:('T -> 'Key) -> array:'T[] -> ('Key * int)[] when 'Key : equality + val countBy: projection: ('T -> 'Key) -> array: 'T[] -> ('Key * int)[] when 'Key: equality /// Creates an array whose elements are all initially the given value. /// @@ -376,7 +378,7 @@ module Array = /// Note each entry in the array is the same mutable cell object. /// [] - val create: count:int -> value:'T -> 'T[] + val create: count: int -> value: 'T -> 'T[] /// Returns the first element of the array, or /// None if the array is empty. @@ -405,10 +407,10 @@ module Array = /// Evaluates to None /// [] - val tryHead: array:'T[] -> 'T option - + val tryHead: array: 'T[] -> 'T option + /// Applies the given function to successive elements, returning the first - /// result where the function returns Some(x) for some x. If the function + /// result where the function returns Some(x) for some x. If the function /// never returns Some(x) then None is returned. /// /// The function to transform the array elements into options. @@ -437,7 +439,7 @@ module Array = /// /// [] - val tryPick: chooser:('T -> 'U option) -> array:'T[] -> 'U option + val tryPick: chooser: ('T -> 'U option) -> array: 'T[] -> 'U option /// Fills a range of elements of the array with the given value. /// @@ -458,10 +460,10 @@ module Array = /// After evaluation target contains [| 0; 1; 2; 100; 100; 5 |]. /// [] - val fill: target:'T[] -> targetIndex:int -> count:int -> value:'T -> unit + val fill: target: 'T[] -> targetIndex: int -> count: int -> value: 'T -> unit /// Applies the given function to successive elements, returning the first - /// result where the function returns Some(x) for some x. If the function + /// result where the function returns Some(x) for some x. If the function /// never returns Some(x) then is raised. /// /// The function to generate options from the elements. @@ -492,7 +494,7 @@ module Array = /// /// [] - val pick: chooser:('T -> 'U option) -> array:'T[] -> 'U + val pick: chooser: ('T -> 'U option) -> array: 'T[] -> 'U /// Applies the given function to each element of the array. Returns /// the array comprised of the results x for each element where @@ -523,7 +525,7 @@ module Array = /// Evaluates to [| 2 |] /// [] - val choose: chooser:('T -> 'U option) -> array:'T[] -> 'U[] + val choose: chooser: ('T -> 'U option) -> array: 'T[] -> 'U[] /// Divides the input array into chunks of size at most chunkSize. /// @@ -553,7 +555,7 @@ module Array = /// Throws ArgumentException /// [] - val chunkBySize: chunkSize:int -> array:'T[] -> 'T[][] + val chunkBySize: chunkSize: int -> array: 'T[] -> 'T[][] /// Returns an array that contains no duplicate entries according to generic hash and /// equality comparisons on the entries. @@ -574,9 +576,9 @@ module Array = /// Evaluates to [| 1; 2; 3 |] /// [] - val distinct: array:'T[] -> 'T[] when 'T : equality + val distinct: array: 'T[] -> 'T[] when 'T: equality - /// Returns an array that contains no duplicate entries according to the + /// Returns an array that contains no duplicate entries according to the /// generic hash and equality comparisons on the keys returned by the given key-generating function. /// If an element occurs multiple times in the array then the later occurrences are discarded. /// @@ -596,7 +598,7 @@ module Array = /// Evaluates to [| { Bar = 1 }; { Bar = 2 }; { Bar = 3 } |] /// [] - val distinctBy: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : equality + val distinctBy: projection: ('T -> 'Key) -> array: 'T[] -> 'T[] when 'Key: equality /// Splits the input array into at most count chunks. /// @@ -626,7 +628,7 @@ module Array = /// Throws ArgumentException /// [] - val splitInto: count:int -> array:'T[] -> 'T[][] + val splitInto: count: int -> array: 'T[] -> 'T[][] /// Returns an empty array of the given type. /// The empty array. @@ -676,7 +678,7 @@ module Array = /// Throws ArgumentException /// [] - val exactlyOne: array:'T[] -> 'T + val exactlyOne: array: 'T[] -> 'T /// Returns the only element of the array or None if array is empty or contains more than one element. /// @@ -713,7 +715,7 @@ module Array = /// Evaluates to None /// [] - val tryExactlyOne: array:'T[] -> 'T option + val tryExactlyOne: array: 'T[] -> 'T option /// Returns a new list with the distinct elements of the input array which do not appear in the itemsToExclude sequence, /// using generic hash and equality comparisons to compare values. @@ -736,12 +738,12 @@ module Array = /// Evaluates to [| 2; 4 |] /// [] - val except: itemsToExclude:seq<'T> -> array:'T[] -> 'T[] when 'T : equality + val except: itemsToExclude: seq<'T> -> array: 'T[] -> 'T[] when 'T: equality /// Tests if any element of the array satisfies the given predicate. /// - /// The predicate is applied to the elements of the input array. If any application - /// returns true then the overall result is true and no further elements are tested. + /// The predicate is applied to the elements of the input array. If any application + /// returns true then the overall result is true and no further elements are tested. /// Otherwise, false is returned. /// /// The function to test the input elements. @@ -769,14 +771,14 @@ module Array = /// Evaluates to false /// [] - val inline exists: predicate:('T -> bool) -> array:'T[] -> bool + val inline exists: predicate: ('T -> bool) -> array: 'T[] -> bool /// Tests if any pair of corresponding elements of the arrays satisfies the given predicate. /// - /// The predicate is applied to matching elements in the two collections up to the lesser of the - /// two lengths of the collections. If any application returns true then the overall result is - /// true and no further elements are tested. Otherwise, if one collections is longer - /// than the other then the ArgumentException exception is raised. + /// The predicate is applied to matching elements in the two collections up to the lesser of the + /// two lengths of the collections. If any application returns true then the overall result is + /// true and no further elements are tested. Otherwise, if one collections is longer + /// than the other then the ArgumentException exception is raised. /// Otherwise, false is returned. /// /// The function to test the input elements. @@ -808,7 +810,7 @@ module Array = /// Evaluates to true /// [] - val exists2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1[] -> array2:'T2[] -> bool + val exists2: predicate: ('T1 -> 'T2 -> bool) -> array1: 'T1[] -> array2: 'T2[] -> bool /// Returns a new collection containing only the elements of the collection /// for which the given predicate returns "true". @@ -829,7 +831,7 @@ module Array = /// Evaluates to [| 2; 4 |] /// [] - val filter: predicate:('T -> bool) -> array:'T[] -> 'T[] + val filter: predicate: ('T -> bool) -> array: 'T[] -> 'T[] /// Returns the first element for which the given function returns 'true'. /// Raise if no such element exists. @@ -861,7 +863,7 @@ module Array = /// Throws KeyNotFoundException /// [] - val find: predicate:('T -> bool) -> array:'T[] -> 'T + val find: predicate: ('T -> bool) -> array: 'T[] -> 'T /// Returns the last element for which the given function returns 'true'. /// Raise if no such element exists. @@ -893,10 +895,10 @@ module Array = /// Throws KeyNotFoundException /// [] - val findBack: predicate:('T -> bool) -> array:'T[] -> 'T + val findBack: predicate: ('T -> bool) -> array: 'T[] -> 'T /// Returns the index of the first element in the array - /// that satisfies the given predicate. Raise if + /// that satisfies the given predicate. Raise if /// none of the elements satisfy the predicate. /// /// The function to test the input elements. @@ -925,7 +927,7 @@ module Array = /// Throws KeyNotFoundException /// [] - val findIndex: predicate:('T -> bool) -> array:'T[] -> int + val findIndex: predicate: ('T -> bool) -> array: 'T[] -> int /// Returns the index of the last element in the array /// that satisfies the given predicate. Raise if @@ -958,12 +960,12 @@ module Array = /// Throws KeyNotFoundException /// [] - val findIndexBack: predicate:('T -> bool) -> array:'T[] -> int + val findIndexBack: predicate: ('T -> bool) -> array: 'T[] -> int /// Tests if all elements of the array satisfy the given predicate. /// - /// The predicate is applied to the elements of the input collection. If any application - /// returns false then the overall result is false and no further elements are tested. + /// The predicate is applied to the elements of the input collection. If any application + /// returns false then the overall result is false and no further elements are tested. /// Otherwise, true is returned. /// /// The function to test the input elements. @@ -983,14 +985,14 @@ module Array = /// /// [] - val forall: predicate:('T -> bool) -> array:'T[] -> bool + val forall: predicate: ('T -> bool) -> array: 'T[] -> bool /// Tests if all corresponding elements of the array satisfy the given predicate pairwise. /// - /// The predicate is applied to matching elements in the two collections up to the lesser of the - /// two lengths of the collections. If any application returns false then the overall result is - /// false and no further elements are tested. Otherwise, if one collection is longer - /// than the other then the ArgumentException exception is raised. + /// The predicate is applied to matching elements in the two collections up to the lesser of the + /// two lengths of the collections. If any application returns false then the overall result is + /// false and no further elements are tested. Otherwise, if one collection is longer + /// than the other then the ArgumentException exception is raised. /// Otherwise, true is returned. /// /// The function to test the input elements. @@ -1032,10 +1034,10 @@ module Array = /// Throws ArgumentException. /// [] - val forall2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1[] -> array2:'T2[] -> bool + val forall2: predicate: ('T1 -> 'T2 -> bool) -> array1: 'T1[] -> array2: 'T2[] -> bool /// Applies a function to each element of the collection, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN then computes + /// through the computation. If the input function is f and the elements are i0...iN then computes /// f (... (f s i0)...) iN /// /// The function to update the state given the input elements. @@ -1062,10 +1064,10 @@ module Array = /// Evaluates to 2 /// [] - val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> array: 'T[] -> 'State + val fold<'T, 'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> array: 'T[] -> 'State /// Applies a function to each element of the array, starting from the end, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN then computes + /// through the computation. If the input function is f and the elements are i0...iN then computes /// f i0 (...(f iN s)) /// /// The function to update the state given the input elements. @@ -1105,9 +1107,9 @@ module Array = /// /// [] - val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> array:'T[] -> state:'State -> 'State + val foldBack<'T, 'State> : folder: ('T -> 'State -> 'State) -> array: 'T[] -> state: 'State -> 'State - /// Applies a function to pairs of elements drawn from the two collections, + /// Applies a function to pairs of elements drawn from the two collections, /// left-to-right, threading an accumulator argument /// through the computation. The two input /// arrays must have the same lengths, otherwise an ArgumentException is @@ -1139,9 +1141,10 @@ module Array = /// Evaluates to 1 /// [] - val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> array1:'T1[] -> array2:'T2[] -> 'State + val fold2<'T1, 'T2, 'State> : + folder: ('State -> 'T1 -> 'T2 -> 'State) -> state: 'State -> array1: 'T1[] -> array2: 'T2[] -> 'State - /// Apply a function to pairs of elements drawn from the two collections, right-to-left, + /// Apply a function to pairs of elements drawn from the two collections, right-to-left, /// threading an accumulator argument through the computation. The two input /// arrays must have the same lengths, otherwise an ArgumentException is /// raised. @@ -1187,7 +1190,8 @@ module Array = /// /// [] - val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> array1:'T1[] -> array2:'T2[] -> state:'State -> 'State + val foldBack2<'T1, 'T2, 'State> : + folder: ('T1 -> 'T2 -> 'State -> 'State) -> array1: 'T1[] -> array2: 'T2[] -> state: 'State -> 'State /// Gets an element from an array. /// @@ -1219,7 +1223,7 @@ module Array = /// Throws IndexOutOfRangeException /// [] - val get: array:'T[] -> index:int -> 'T + val get: array: 'T[] -> index: int -> 'T /// Returns the first element of the array. /// @@ -1246,10 +1250,10 @@ module Array = /// Throws ArgumentException /// [] - val head: array:'T[] -> 'T + val head: array: 'T[] -> 'T - /// Applies a key-generating function to each element of an array and yields an array of - /// unique keys. Each unique key contains an array of all elements that match + /// Applies a key-generating function to each element of an array and yields an array of + /// unique keys. Each unique key contains an array of all elements that match /// to this key. /// /// A function that transforms an element of the array into a comparable key. @@ -1268,7 +1272,7 @@ module Array = /// Evaluates to [| (1, [| 1; 3; 5 |]); (0, [| 2; 4 |]) |] /// [] - val groupBy: projection:('T -> 'Key) -> array:'T[] -> ('Key * 'T[])[] when 'Key : equality + val groupBy: projection: ('T -> 'Key) -> array: 'T[] -> ('Key * 'T[])[] when 'Key: equality /// Builds a new array whose elements are the corresponding elements of the input array /// paired with the integer index (from 0) of each element. @@ -1288,7 +1292,7 @@ module Array = /// Evaluates to [| (0, "a"); (1, "b"); (2, "c") |] /// [] - val indexed: array:'T[] -> (int * 'T)[] + val indexed: array: 'T[] -> (int * 'T)[] /// Creates an array given the dimension and a generator function to compute the elements. /// @@ -1313,7 +1317,7 @@ module Array = /// Throws ArgumentException /// [] - val inline init: count:int -> initializer:(int -> 'T) -> 'T[] + val inline init: count: int -> initializer: (int -> 'T) -> 'T[] /// Creates an array where the entries are initially the default value Unchecked.defaultof<'T>. /// @@ -1330,8 +1334,8 @@ module Array = /// Evaluates to [| 0; 0; 0; 0 |] /// [] - val zeroCreate: count:int -> 'T[] - + val zeroCreate: count: int -> 'T[] + /// Returns true if the given array is empty, otherwise false. /// /// The input array. @@ -1354,7 +1358,7 @@ module Array = /// Evaluates to false /// [] - val isEmpty: array:'T[] -> bool + val isEmpty: array: 'T[] -> bool /// Applies the given function to each element of the array. /// @@ -1378,7 +1382,7 @@ module Array = /// in the console. /// [] - val inline iter: action:('T -> unit) -> array:'T[] -> unit + val inline iter: action: ('T -> unit) -> array: 'T[] -> unit /// Applies the given function to pair of elements drawn from matching indices in two arrays. The /// two arrays must have the same lengths, otherwise an ArgumentException is @@ -1407,7 +1411,7 @@ module Array = /// in the console. /// [] - val iter2: action:('T1 -> 'T2 -> unit) -> array1:'T1[] -> array2:'T2[] -> unit + val iter2: action: ('T1 -> 'T2 -> unit) -> array1: 'T1[] -> array2: 'T2[] -> unit /// Applies the given function to each element of the array. The integer passed to the /// function indicates the index of element. @@ -1432,10 +1436,10 @@ module Array = /// in the console. /// [] - val iteri: action:(int -> 'T -> unit) -> array:'T[] -> unit + val iteri: action: (int -> 'T -> unit) -> array: 'T[] -> unit /// Applies the given function to pair of elements drawn from matching indices in two arrays, - /// also passing the index of the elements. The two arrays must have the same lengths, + /// also passing the index of the elements. The two arrays must have the same lengths, /// otherwise an ArgumentException is raised. /// /// The function to apply to each index and pair of elements. @@ -1461,7 +1465,7 @@ module Array = /// in the console. /// [] - val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> array1:'T1[] -> array2:'T2[] -> unit + val iteri2: action: (int -> 'T1 -> 'T2 -> unit) -> array1: 'T1[] -> array2: 'T2[] -> unit /// Returns the last element of the array. /// @@ -1486,7 +1490,7 @@ module Array = /// Throws ArgumentException /// [] - val inline last: array:'T[] -> 'T + val inline last: array: 'T[] -> 'T /// Gets an element from an array. /// @@ -1518,7 +1522,7 @@ module Array = /// Throws ArgumentException /// [] - val item: index:int -> array:'T[] -> 'T + val item: index: int -> array: 'T[] -> 'T /// Returns the length of an array. You can also use property arr.Length. /// @@ -1539,8 +1543,8 @@ module Array = /// Evaluates to 3 /// [] - val length: array:'T[] -> int - + val length: array: 'T[] -> int + /// Returns the last element of the array. /// Return None if no such element exists. /// @@ -1548,7 +1552,7 @@ module Array = /// /// The last element of the array or None. /// - /// Thrown when the input sequence is null. + /// Thrown when the input sequence is null. /// /// /// @@ -1564,7 +1568,7 @@ module Array = /// Evaluates to None /// [] - val tryLast: array:'T[] -> 'T option + val tryLast: array: 'T[] -> 'T option /// Builds a new array whose elements are the results of applying the given function /// to each of the elements of the array. @@ -1585,7 +1589,7 @@ module Array = /// Evaluates to [| 1; 3; 2 |] /// [] - val inline map: mapping:('T -> 'U) -> array:'T[] -> 'U[] + val inline map: mapping: ('T -> 'U) -> array: 'T[] -> 'U[] /// Builds a new collection whose elements are the results of applying the given function /// to the corresponding elements of the two collections pairwise. The two input @@ -1611,7 +1615,7 @@ module Array = /// Evaluates to [| 'a'; 'd'; 'o' |] /// [] - val map2: mapping:('T1 -> 'T2 -> 'U) -> array1:'T1[] -> array2:'T2[] -> 'U[] + val map2: mapping: ('T1 -> 'T2 -> 'U) -> array1: 'T1[] -> array2: 'T2[] -> 'U[] /// Combines map and fold. Builds a new array whose elements are the results of applying the given function /// to each of the elements of the input array. The function is also used to accumulate a final value. @@ -1641,7 +1645,8 @@ module Array = /// Evaluates newCharges to [|In 2; Out 4; In 6|] and balance to 2. /// [] - val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> array:'T[] -> 'Result[] * 'State + val mapFold<'T, 'State, 'Result> : + mapping: ('State -> 'T -> 'Result * 'State) -> state: 'State -> array: 'T[] -> 'Result[] * 'State /// Combines map and foldBack. Builds a new array whose elements are the results of applying the given function /// to each of the elements of the input array. The function is also used to accumulate a final value. @@ -1671,7 +1676,8 @@ module Array = /// Evaluates newCharges to [|In 2; Out 4; In 6|] and balance to 2. /// [] - val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> array:'T[] -> state:'State -> 'Result[] * 'State + val mapFoldBack<'T, 'State, 'Result> : + mapping: ('T -> 'State -> 'Result * 'State) -> array: 'T[] -> state: 'State -> 'Result[] * 'State /// Builds a new collection whose elements are the results of applying the given function /// to the corresponding triples from the three collections. The three input @@ -1698,12 +1704,12 @@ module Array = /// /// Evaluates to [| "all"; "the"; "time" |] /// - /// + /// [] - val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> array1:'T1[] -> array2:'T2[] -> array3:'T3[] -> 'U[] + val map3: mapping: ('T1 -> 'T2 -> 'T3 -> 'U) -> array1: 'T1[] -> array2: 'T2[] -> array3: 'T3[] -> 'U[] /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding elements of the two collections pairwise, also passing the index of + /// to the corresponding elements of the two collections pairwise, also passing the index of /// the elements. The two input arrays must have the same lengths, otherwise an ArgumentException is /// raised. /// @@ -1726,7 +1732,7 @@ module Array = /// Evaluates to [|(0, 'a'); (1, 'd'); (2, 'o')|] /// [] - val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> array1:'T1[] -> array2:'T2[] -> 'U[] + val mapi2: mapping: (int -> 'T1 -> 'T2 -> 'U) -> array1: 'T1[] -> array2: 'T2[] -> 'U[] /// Builds a new array whose elements are the results of applying the given function /// to each of the elements of the array. The integer index passed to the @@ -1748,7 +1754,7 @@ module Array = /// Evaluates to [| 10; 11; 12 |] /// [] - val mapi: mapping:(int -> 'T -> 'U) -> array:'T[] -> 'U[] + val mapi: mapping: (int -> 'T -> 'U) -> array: 'T[] -> 'U[] /// Returns the greatest of all elements of the array, compared via Operators.max on the function result. /// @@ -1779,7 +1785,7 @@ module Array = /// Throws System.ArgumentException. /// [] - val inline max: array:'T[] -> 'T when 'T : comparison + val inline max: array: 'T[] -> 'T when 'T: comparison /// Returns the greatest of all elements of the array, compared via Operators.max on the function result. /// @@ -1811,7 +1817,7 @@ module Array = /// Throws System.ArgumentException. /// [] - val inline maxBy : projection:('T -> 'U) -> array:'T[] -> 'T when 'U : comparison + val inline maxBy: projection: ('T -> 'U) -> array: 'T[] -> 'T when 'U: comparison /// Returns the lowest of all elements of the array, compared via Operators.min. /// @@ -1842,7 +1848,7 @@ module Array = /// Throws System.ArgumentException. /// [] - val inline min: array:'T[] -> 'T when 'T : comparison + val inline min: array: 'T[] -> 'T when 'T: comparison /// Returns the lowest of all elements of the array, compared via Operators.min on the function result. /// @@ -1874,14 +1880,14 @@ module Array = /// Throws System.ArgumentException. /// [] - val inline minBy : projection:('T -> 'U) -> array:'T[] -> 'T when 'U : comparison + val inline minBy: projection: ('T -> 'U) -> array: 'T[] -> 'T when 'U: comparison /// Builds an array from the given list. /// /// The input list. /// /// The array of elements from the list. - /// + /// /// /// /// let inputs = [ 1; 2; 5 ] @@ -1891,7 +1897,7 @@ module Array = /// Evaluates to [| 1; 2; 5 |]. /// [] - val ofList: list:'T list -> 'T[] + val ofList: list: 'T list -> 'T[] /// Builds a new array from the given enumerable object. /// @@ -1900,7 +1906,7 @@ module Array = /// The array of elements from the sequence. /// /// Thrown when the input sequence is null. - /// + /// /// /// /// let inputs = seq { 1; 2; 5 } @@ -1910,7 +1916,7 @@ module Array = /// Evaluates to [| 1; 2; 5 |]. /// [] - val ofSeq: source:seq<'T> -> 'T[] + val ofSeq: source: seq<'T> -> 'T[] /// Returns an array of each element in the input array and its predecessor, with the /// exception of the first element which is only returned as the predecessor of the second element. @@ -1920,7 +1926,7 @@ module Array = /// The result array. /// /// Thrown when the input sequence is null. - /// + /// /// /// /// let inputs = [| 1; 2; 3; 4 |] @@ -1930,9 +1936,9 @@ module Array = /// Evaluates to [|(1, 2); (2, 3); (3, 4)|]. /// [] - val pairwise: array:'T[] -> ('T * 'T)[] + val pairwise: array: 'T[] -> ('T * 'T)[] - /// Splits the collection into two collections, containing the + /// Splits the collection into two collections, containing the /// elements for which the given predicate returns "true" and "false" /// respectively. /// @@ -1943,7 +1949,7 @@ module Array = /// and the second containing those evaluated to false. /// /// Thrown when the input array is null. - /// + /// /// /// /// let inputs = [| 1; 2; 3; 4 |] @@ -1953,7 +1959,7 @@ module Array = /// Evaluates to ([|2; 4|], [|1; 3|]). /// [] - val partition: predicate:('T -> bool) -> array:'T[] -> 'T[] * 'T[] + val partition: predicate: ('T -> bool) -> array: 'T[] -> 'T[] * 'T[] /// Returns an array with all elements permuted according to the /// specified permutation. @@ -1965,7 +1971,7 @@ module Array = /// /// Thrown when the input array is null. /// Thrown when indexMap does not produce a valid permutation. - /// + /// /// /// /// let inputs = [| 1; 2; 3; 4 |] @@ -1975,10 +1981,10 @@ module Array = /// Evaluates to [|4; 1; 2; 3|]. /// [] - val permute: indexMap:(int -> int) -> array:'T[] -> 'T[] + val permute: indexMap: (int -> int) -> array: 'T[] -> 'T[] /// Applies a function to each element of the array, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN + /// through the computation. If the input function is f and the elements are i0...iN /// then computes f (... (f i0 i1)...) iN. /// Raises ArgumentException if the array has size zero. /// @@ -1989,7 +1995,7 @@ module Array = /// Thrown when the input array is empty. /// /// The final result of the reductions. - /// + /// /// /// /// let inputs = [| 1; 3; 4; 2 |] @@ -1999,10 +2005,10 @@ module Array = /// Evaluates to 1342, by computing ((1 * 10 + 3) * 10 + 4) * 10 + 2 /// [] - val reduce: reduction:('T -> 'T -> 'T) -> array:'T[] -> 'T + val reduce: reduction: ('T -> 'T -> 'T) -> array: 'T[] -> 'T /// Applies a function to each element of the array, starting from the end, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN + /// through the computation. If the input function is f and the elements are i0...iN /// then computes f i0 (...(f iN-1 iN)). /// /// A function that takes in the next-to-last element of the list and the @@ -2013,7 +2019,7 @@ module Array = /// Thrown when the input array is empty. /// /// The final result of the reductions. - /// + /// /// /// /// let inputs = [| 1; 3; 4; 2 |] @@ -2023,7 +2029,7 @@ module Array = /// Evaluates to 2431, by computing 1 + (3 + (4 + 2 * 10) * 10) * 10 /// [] - val reduceBack: reduction:('T -> 'T -> 'T) -> array:'T[] -> 'T + val reduceBack: reduction: ('T -> 'T -> 'T) -> array: 'T[] -> 'T /// Creates an array by replicating the given initial value. /// @@ -2033,7 +2039,7 @@ module Array = /// The generated array. /// /// Thrown when count is negative. - /// + /// /// /// /// Array.replicate 3 "a" @@ -2041,7 +2047,7 @@ module Array = /// Evaluates to [| "a"; "a"; "a" |]. /// [] - val replicate: count:int -> initial:'T -> 'T[] + val replicate: count: int -> initial: 'T -> 'T[] /// Returns a new array with the elements in reverse order. /// @@ -2050,7 +2056,7 @@ module Array = /// The reversed array. /// /// Thrown when the input array is null. - /// + /// /// /// /// Array.rev [| 0; 1; 2 |] @@ -2058,7 +2064,7 @@ module Array = /// Evaluates to [| 2; 1; 0 |]. /// [] - val rev: array:'T[] -> 'T[] + val rev: array: 'T[] -> 'T[] /// Like fold, but return the intermediary and final results. /// @@ -2069,7 +2075,7 @@ module Array = /// The array of state values. /// /// Thrown when the input array is null. - /// + /// /// Apply a list charges and collect the running balances as each is applied: /// /// type Charge = @@ -2087,7 +2093,7 @@ module Array = /// state, 1 the next state, -1 the next state, and 2 the final state. /// [] - val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> array:'T[] -> 'State[] + val scan<'T, 'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> array: 'T[] -> 'State[] /// Like foldBack, but return both the intermediary and final results. /// @@ -2098,7 +2104,7 @@ module Array = /// The array of state values. /// /// Thrown when the input array is null. - /// + /// /// Apply a list charges from back to front, and collect the running balances as each is applied: /// /// type Charge = @@ -2116,14 +2122,14 @@ module Array = /// state, 3 the next state, 1 the next state, and 2 the final state. /// [] - val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> array:'T[] -> state:'State -> 'State[] + val scanBack<'T, 'State> : folder: ('T -> 'State -> 'State) -> array: 'T[] -> state: 'State -> 'State[] /// Returns an array that contains one item only. /// /// The input item. /// /// The result array of one item. - /// + /// /// /// /// Array.singleton 7 @@ -2131,7 +2137,7 @@ module Array = /// Evaluates to [| 7 |]. /// [] - val inline singleton: value:'T -> 'T[] + val inline singleton: value: 'T -> 'T[] /// Sets an element of an array. /// @@ -2160,7 +2166,7 @@ module Array = /// Throws IndexOutOfRangeException /// [] - val set: array:'T[] -> index:int -> value:'T -> unit + val set: array: 'T[] -> index: int -> value: 'T -> unit /// Builds a new array that contains the elements of the given array, excluding the first N elements. /// @@ -2170,7 +2176,7 @@ module Array = /// A copy of the input array, after removing the first N elements. /// /// Thrown when the input array is null. - /// Thrown when count exceeds the number of + /// Thrown when count exceeds the number of /// elements in the array. /// /// @@ -2200,7 +2206,7 @@ module Array = /// Evaluates to [| "a"; "b"; "c"; "d" |]. /// [] - val skip: count:int -> array:'T[] -> 'T[] + val skip: count: int -> array: 'T[] -> 'T[] /// Bypasses elements in an array while the given predicate returns True, and then returns /// the remaining elements in a new array. @@ -2222,7 +2228,7 @@ module Array = /// /// [] - val skipWhile: predicate:('T -> bool) -> array:'T[] -> 'T[] + val skipWhile: predicate: ('T -> bool) -> array: 'T[] -> 'T[] /// Builds a new array that contains the given subrange specified by /// starting index and length. @@ -2255,11 +2261,11 @@ module Array = /// Evaluates to [| 2; 3; 4 |]. /// [] - val sub: array:'T[] -> startIndex:int -> count:int -> 'T[] + val sub: array: 'T[] -> startIndex: int -> count: int -> 'T[] /// Sorts the elements of an array, returning a new array. Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The input array. @@ -2267,7 +2273,7 @@ module Array = /// The sorted array. /// /// Thrown when the input array is null. - /// + /// /// /// /// let input = [| 8; 4; 3; 1; 6; 1 |] @@ -2277,12 +2283,12 @@ module Array = /// Evaluates to [| 1; 1 3; 4; 6; 8 |]. /// [] - val sort: array:'T[] -> 'T[] when 'T : comparison + val sort: array: 'T[] -> 'T[] when 'T: comparison - /// Sorts the elements of an array, using the given projection for the keys and returning a new array. + /// Sorts the elements of an array, using the given projection for the keys and returning a new array. /// Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The function to transform array elements into the type that is compared. @@ -2291,7 +2297,7 @@ module Array = /// The sorted array. /// /// Thrown when the input array is null. - /// + /// /// /// /// let input = [| "a"; "bbb"; "cccc"; "dd" |] @@ -2301,11 +2307,11 @@ module Array = /// Evaluates to [|"a"; "dd"; "bbb"; "cccc"|]. /// [] - val sortBy: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison + val sortBy: projection: ('T -> 'Key) -> array: 'T[] -> 'T[] when 'Key: comparison /// Sorts the elements of an array, using the given comparison function as the order, returning a new array. /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The function to compare pairs of array elements. @@ -2314,7 +2320,7 @@ module Array = /// The sorted array. /// /// Thrown when the input array is null. - /// + /// /// Sort an array of pairs using a comparison function that compares string lengths then index numbers: /// /// let compareEntries (n1: int, s1: string) (n2: int, s2: string) = @@ -2329,19 +2335,19 @@ module Array = /// Evaluates to [|(0, "aa"); (2, "cc"); (3, "dd"); (1, "bbb")|]. /// [] - val sortWith: comparer:('T -> 'T -> int) -> array:'T[] -> 'T[] + val sortWith: comparer: ('T -> 'T -> int) -> array: 'T[] -> 'T[] - /// Sorts the elements of an array by mutating the array in-place, using the given projection for the keys. + /// Sorts the elements of an array by mutating the array in-place, using the given projection for the keys. /// Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The function to transform array elements into the type that is compared. /// The input array. /// /// Thrown when the input array is null. - /// + /// /// /// /// let array = [| "a"; "bbb"; "cccc"; "dd" |] @@ -2351,7 +2357,7 @@ module Array = /// After evaluation array contains [|"a"; "dd"; "bbb"; "cccc"|]. /// [] - val sortInPlaceBy: projection:('T -> 'Key) -> array:'T[] -> unit when 'Key : comparison + val sortInPlaceBy: projection: ('T -> 'Key) -> array: 'T[] -> unit when 'Key: comparison /// Sorts the elements of an array by mutating the array in-place, using the given comparison function as the order. /// @@ -2359,7 +2365,7 @@ module Array = /// The input array. /// /// Thrown when the input array is null. - /// + /// /// The following sorts entries using a comparison function that compares string lengths then index numbers: /// /// let compareEntries (n1: int, s1: string) (n2: int, s2: string) = @@ -2374,15 +2380,15 @@ module Array = /// After evaluation array contains [|(0, "aa"); (2, "cc"); (3, "dd"); (1, "bbb")|]. /// [] - val sortInPlaceWith: comparer:('T -> 'T -> int) -> array:'T[] -> unit + val sortInPlaceWith: comparer: ('T -> 'T -> int) -> array: 'T[] -> unit - /// Sorts the elements of an array by mutating the array in-place, using the given comparison function. + /// Sorts the elements of an array by mutating the array in-place, using the given comparison function. /// Elements are compared using . /// /// The input array. /// /// Thrown when the input array is null. - /// + /// /// /// /// let array = [| 8; 4; 3; 1; 6; 1 |] @@ -2392,7 +2398,7 @@ module Array = /// After evaluation array contains [| 1; 1; 3; 4; 6; 8 |]. /// [] - val sortInPlace: array:'T[] -> unit when 'T : comparison + val sortInPlace: array: 'T[] -> unit when 'T: comparison /// Splits an array into two arrays, at the given index. /// @@ -2404,7 +2410,7 @@ module Array = /// Thrown when the input array is null. /// Thrown when split index exceeds the number of elements /// in the array. - /// + /// /// /// /// let input = [| 8; 4; 3; 1; 6; 1 |] @@ -2414,17 +2420,17 @@ module Array = /// Evaluates front to [|8; 4; 3|] and back to [|1; 6; 1|]. /// [] - val splitAt: index:int -> array:'T[] -> ('T[] * 'T[]) + val splitAt: index: int -> array: 'T[] -> ('T[] * 'T[]) /// Sorts the elements of an array, in descending order, returning a new array. Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The input array. /// /// The sorted array. - /// + /// /// /// /// let input = [| 8; 4; 3; 1; 6; 1 |] @@ -2434,19 +2440,19 @@ module Array = /// Evaluates to [| 8; 6; 4; 3; 1; 1 |]. /// [] - val inline sortDescending: array:'T[] -> 'T[] when 'T : comparison + val inline sortDescending: array: 'T[] -> 'T[] when 'T: comparison - /// Sorts the elements of an array, in descending order, using the given projection for the keys and returning a new array. + /// Sorts the elements of an array, in descending order, using the given projection for the keys and returning a new array. /// Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The function to transform array elements into the type that is compared. /// The input array. /// /// The sorted array. - /// + /// /// /// /// let input = [| "a"; "bbb"; "cccc"; "dd" |] @@ -2456,7 +2462,7 @@ module Array = /// Evaluates to [|"cccc"; "bbb"; "dd"; "a"|]. /// [] - val inline sortByDescending: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison + val inline sortByDescending: projection: ('T -> 'Key) -> array: 'T[] -> 'T[] when 'Key: comparison /// Returns the sum of the elements in the array. /// @@ -2465,7 +2471,7 @@ module Array = /// The resulting sum. /// /// Thrown when the input array is null. - /// + /// /// /// /// let input = [| 1; 5; 3; 2 |] @@ -2475,10 +2481,7 @@ module Array = /// Evaluates to 11. /// [] - val inline sum: array: ^T[] -> ^T - when ^T : (static member ( + ) : ^T * ^T -> ^T) - and ^T : (static member Zero : ^T) - + val inline sum: array: ^T[] -> ^T when ^T: (static member (+): ^T * ^T -> ^T) and ^T: (static member Zero: ^T) /// Returns the sum of the results generated by applying the function to each element of the array. /// @@ -2488,7 +2491,7 @@ module Array = /// The resulting sum. /// /// Thrown when the input array is null. - /// + /// /// /// /// let input = [| "aa"; "bbb"; "cc" |] @@ -2498,9 +2501,9 @@ module Array = /// Evaluates to 7. /// [] - val inline sumBy: projection:('T -> ^U) -> array:'T[] -> ^U - when ^U : (static member ( + ) : ^U * ^U -> ^U) - and ^U : (static member Zero : ^U) + val inline sumBy: + projection: ('T -> ^U) -> array: 'T[] -> ^U + when ^U: (static member (+): ^U * ^U -> ^U) and ^U: (static member Zero: ^U) /// Returns the first N elements of the array. /// Throws InvalidOperationException @@ -2544,9 +2547,9 @@ module Array = /// Evaluates to [| |]. /// [] - val take: count:int -> array:'T[] -> 'T[] + val take: count: int -> array: 'T[] -> 'T[] - /// Returns an array that contains all elements of the original array while the + /// Returns an array that contains all elements of the original array while the /// given predicate returns True, and then returns no further elements. /// /// A function that evaluates to false when no more items should be returned. @@ -2566,7 +2569,7 @@ module Array = /// /// [] - val takeWhile: predicate:('T -> bool) -> array:'T[] -> 'T[] + val takeWhile: predicate: ('T -> bool) -> array: 'T[] -> 'T[] /// Returns a new array containing the elements of the original except the first element. /// @@ -2587,7 +2590,7 @@ module Array = /// /// [] - val tail: array:'T[] -> 'T[] + val tail: array: 'T[] -> 'T[] /// Builds a list from the given array. /// @@ -2606,7 +2609,7 @@ module Array = /// Evaluates to [ 1; 2; 5 ]. /// [] - val toList: array:'T[] -> 'T list + val toList: array: 'T[] -> 'T list /// Views the given array as a sequence. /// @@ -2625,7 +2628,7 @@ module Array = /// Evaluates to seq { 1; 2; 5 }. /// [] - val toSeq: array:'T[] -> seq<'T> + val toSeq: array: 'T[] -> seq<'T> /// Returns the transpose of the given sequence of arrays. /// @@ -2647,7 +2650,7 @@ module Array = /// Evaluates to [|[|10; 11|]; [|20; 21|]; [|30; 31|]|]. /// [] - val transpose: arrays:seq<'T[]> -> 'T[][] + val transpose: arrays: seq<'T[]> -> 'T[][] /// Returns at most N elements in a new array. /// @@ -2685,7 +2688,7 @@ module Array = /// Evaluates to [| |]. /// [] - val truncate: count:int -> array:'T[] -> 'T[] + val truncate: count: int -> array: 'T[] -> 'T[] /// Returns the first element for which the given function returns True. /// Return None if no such element exists. @@ -2715,7 +2718,7 @@ module Array = /// Evaluates to None /// [] - val tryFind: predicate:('T -> bool) -> array:'T[] -> 'T option + val tryFind: predicate: ('T -> bool) -> array: 'T[] -> 'T option /// Returns the last element for which the given function returns True. /// Return None if no such element exists. @@ -2745,7 +2748,7 @@ module Array = /// Evaluates to None /// [] - val tryFindBack: predicate:('T -> bool) -> array:'T[] -> 'T option + val tryFindBack: predicate: ('T -> bool) -> array: 'T[] -> 'T option /// Returns the index of the first element in the array /// that satisfies the given predicate. @@ -2775,7 +2778,7 @@ module Array = /// Evaluates to None /// [] - val tryFindIndex : predicate:('T -> bool) -> array:'T[] -> int option + val tryFindIndex: predicate: ('T -> bool) -> array: 'T[] -> int option /// Tries to find the nth element in the array. /// Returns None if index is negative or the input array does not contain enough elements. @@ -2805,7 +2808,7 @@ module Array = /// Evaluates to None. /// [] - val tryItem: index:int -> array:'T[] -> 'T option + val tryItem: index: int -> array: 'T[] -> 'T option /// Returns the index of the last element in the array /// that satisfies the given predicate. @@ -2835,7 +2838,7 @@ module Array = /// Evaluates to None /// [] - val tryFindIndexBack : predicate:('T -> bool) -> array:'T[] -> int option + val tryFindIndexBack: predicate: ('T -> bool) -> array: 'T[] -> int option /// Returns an array that contains the elements generated by the given computation. /// The generator is repeatedly called to build the list until it returns `None`. @@ -2854,7 +2857,7 @@ module Array = /// Evaluates to [| 1; 2; 4; 8; 16; 32; 64 |] /// [] - val unfold<'T,'State> : generator:('State -> ('T * 'State) option) -> state:'State -> 'T[] + val unfold<'T, 'State> : generator: ('State -> ('T * 'State) option) -> state: 'State -> 'T[] /// Splits an array of pairs into two arrays. /// @@ -2873,7 +2876,7 @@ module Array = /// Evaluates numbers to [|1; 2|] and names to [|"one"; "two"|]. /// [] - val unzip: array:('T1 * 'T2)[] -> ('T1[] * 'T2[]) + val unzip: array: ('T1 * 'T2)[] -> ('T1[] * 'T2[]) /// Splits an array of triples into three arrays. /// @@ -2882,7 +2885,7 @@ module Array = /// The tuple of three arrays. /// /// Thrown when the input array is null. - /// + /// /// /// /// let inputs = [| (1, "one", "I"); (2, "two", "II") |] @@ -2892,7 +2895,7 @@ module Array = /// Evaluates numbers to [|1; 2|], names to [|"one"; "two"|] and roman to [|"I"; "II"|]. /// [] - val unzip3: array:('T1 * 'T2 * 'T3)[] -> ('T1[] * 'T2[] * 'T3[]) + val unzip3: array: ('T1 * 'T2 * 'T3)[] -> ('T1[] * 'T2[] * 'T3[]) /// Returns a new array containing only the elements of the array /// for which the given predicate returns "true". @@ -2915,7 +2918,7 @@ module Array = /// Evaluates to [| 2; 4 |] /// [] - val where: predicate:('T -> bool) -> array:'T[] -> 'T[] + val where: predicate: ('T -> bool) -> array: 'T[] -> 'T[] /// Returns an array of sliding windows containing elements drawn from the input /// array. Each window is returned as a fresh array. @@ -2927,7 +2930,7 @@ module Array = /// /// Thrown when the input array is null. /// Thrown when windowSize is not positive. - /// + /// /// /// /// let inputs = [| 1; 2; 3; 4; 5 |] @@ -2937,7 +2940,7 @@ module Array = /// Evaluates to [|[|1; 2; 3|]; [|2; 3; 4|]; [|3; 4; 5|]|] /// [] - val windowed : windowSize:int -> array:'T[] -> 'T[][] + val windowed: windowSize: int -> array: 'T[] -> 'T[][] /// Combines the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an ArgumentException is /// raised. @@ -2960,7 +2963,7 @@ module Array = /// Evaluates to [| (1, "one"); (2, "two") |]. /// [] - val zip: array1:'T1[] -> array2:'T2[] -> ('T1 * 'T2)[] + val zip: array1: 'T1[] -> array2: 'T2[] -> ('T1 * 'T2)[] /// Combines three arrays into an array of pairs. The three arrays must have equal lengths, otherwise an ArgumentException is /// raised. @@ -2985,17 +2988,17 @@ module Array = /// Evaluates to [|(1, "one", "I"); (2, "two", "II")|]. /// [] - val zip3: array1:'T1[] -> array2:'T2[] -> array3:'T3[] -> ('T1 * 'T2 * 'T3)[] + val zip3: array1: 'T1[] -> array2: 'T2[] -> array3: 'T3[] -> ('T1 * 'T2 * 'T3)[] /// Return a new array with the item at a given index removed. /// /// The index of the item to be removed. /// The input array. - /// + /// /// The result array. - /// + /// /// Thrown when index is outside 0..source.Length - 1 - /// + /// /// /// /// let inputs = [| 0; 1; 2 |] @@ -3005,14 +3008,14 @@ module Array = /// Evaluates to [| 0; 2 |]. /// [] - val removeAt : index: int -> source: 'T[] -> 'T[] - + val removeAt: index: int -> source: 'T[] -> 'T[] + /// Return a new array with the number of items starting at a given index removed. /// /// The index of the item to be removed. /// The number of items to remove. /// The input array. - /// + /// /// The result array. /// /// Thrown when index is outside 0..source.Length - count @@ -3026,14 +3029,14 @@ module Array = /// Evaluates to [| 0; 3 |]. /// [] - val removeManyAt : index: int -> count: int -> source: 'T[] -> 'T[] - + val removeManyAt: index: int -> count: int -> source: 'T[] -> 'T[] + /// Return a new array with the item at a given index set to the new value. /// /// The index of the item to be replaced. /// The new value. /// The input array. - /// + /// /// The result array. /// /// Thrown when index is outside 0..source.Length - 1 @@ -3047,14 +3050,14 @@ module Array = /// Evaluates to [| 0; 9; 2 |]. /// [] - val updateAt : index: int -> value: 'T -> source: 'T[] -> 'T[] - + val updateAt: index: int -> value: 'T -> source: 'T[] -> 'T[] + /// Return a new array with a new item inserted before the given index. /// /// The index where the item should be inserted. /// The value to insert. /// The input array. - /// + /// /// The result array. /// /// Thrown when index is below 0 or greater than source.Length. @@ -3068,14 +3071,14 @@ module Array = /// Evaluates to [| 0; 9; 1; 2 |]. /// [] - val insertAt : index: int -> value: 'T -> source: 'T[] -> 'T[] - + val insertAt: index: int -> value: 'T -> source: 'T[] -> 'T[] + /// Return a new array with new items inserted before the given index. /// /// The index where the items should be inserted. /// The values to insert. /// The input array. - /// + /// /// The result array. /// /// Thrown when index is below 0 or greater than source.Length. @@ -3089,15 +3092,14 @@ module Array = /// Evaluates to [| 0; 8; 9; 1; 2 |]. /// [] - val insertManyAt : index: int -> values: seq<'T> -> source: 'T[] -> 'T[] + val insertManyAt: index: int -> values: seq<'T> -> source: 'T[] -> 'T[] /// Provides parallel operations on arrays module Parallel = - /// Tests if all elements of the array satisfy the given predicate. /// - /// The predicate is applied to the elements of the input collection in parallel. If any application + /// The predicate is applied to the elements of the input collection in parallel. If any application /// returns false then the overall result is false and testing of other elements in all threads is stopped at system's earliest convenience. /// Otherwise, true is returned. /// @@ -3119,11 +3121,11 @@ module Array = /// [] [] - val forall: predicate:('T -> bool) -> array:'T[] -> bool + val forall: predicate: ('T -> bool) -> array: 'T[] -> bool /// Tests if any element of the array satisfies the given predicate. /// - /// The predicate is applied to the elements of the input array in parallel. If any application + /// The predicate is applied to the elements of the input array in parallel. If any application /// returns true then the overall result is true and testing of other elements in all threads is stopped at system's earliest convenience. /// Otherwise, false is returned. /// @@ -3153,7 +3155,7 @@ module Array = /// [] [] - val exists: predicate:('T -> bool) -> array:'T[] -> bool + val exists: predicate: ('T -> bool) -> array: 'T[] -> bool /// Returns the first element for which the given function returns True. /// Returns None if no such element exists. @@ -3184,8 +3186,7 @@ module Array = /// [] [] - val tryFind: predicate:('T -> bool) -> array:'T[] -> 'T option - + val tryFind: predicate: ('T -> bool) -> array: 'T[] -> 'T option /// Returns the index of the first element in the array /// that satisfies the given predicate. @@ -3216,10 +3217,10 @@ module Array = /// [] [] - val tryFindIndex : predicate:('T -> bool) -> array:'T[] -> int option + val tryFindIndex: predicate: ('T -> bool) -> array: 'T[] -> int option /// Applies the given function to successive elements, returning the first - /// result where the function returns Some(x) for some x. If the function + /// result where the function returns Some(x) for some x. If the function /// never returns Some(x) then None is returned. /// /// The function to transform the array elements into options. @@ -3249,7 +3250,7 @@ module Array = /// [] [] - val tryPick: chooser:('T -> 'U option) -> array:'T[] -> 'U option + val tryPick: chooser: ('T -> 'U option) -> array: 'T[] -> 'U option /// Apply the given function to each element of the array. Return /// the array comprised of the results x for each element where @@ -3283,7 +3284,7 @@ module Array = /// Evaluates to [| 2 |] /// [] - val choose: chooser:('T -> 'U option) -> array:'T[] -> 'U[] + val choose: chooser: ('T -> 'U option) -> array: 'T[] -> 'U[] /// For each element of the array, apply the given function. Concatenate all the results and return the combined array. /// @@ -3317,8 +3318,8 @@ module Array = /// Evaluates to [| 1; 2; 3; 4 |] /// [] - val collect: mapping:('T -> 'U[]) -> array:'T[] -> 'U[] - + val collect: mapping: ('T -> 'U[]) -> array: 'T[] -> 'U[] + /// Build a new array whose elements are the results of applying the given function /// to each of the elements of the array. /// @@ -3341,8 +3342,8 @@ module Array = /// Evaluates to [| 1; 3; 2 |] /// [] - val map: mapping:('T -> 'U) -> array:'T[] -> 'U[] - + val map: mapping: ('T -> 'U) -> array: 'T[] -> 'U[] + /// Build a new array whose elements are the results of applying the given function /// to each of the elements of the array. The integer index passed to the /// function indicates the index of element being transformed. @@ -3366,16 +3367,15 @@ module Array = /// Evaluates to [| 10; 11; 12 |] /// [] - val mapi: mapping:(int -> 'T -> 'U) -> array:'T[] -> 'U[] + val mapi: mapping: (int -> 'T -> 'U) -> array: 'T[] -> 'U[] - /// Applies a key-generating function to each element of an array in parallel and yields an array of - /// unique keys. Each unique key contains an array of all elements that match + /// Applies a key-generating function to each element of an array in parallel and yields an array of + /// unique keys. Each unique key contains an array of all elements that match /// to this key. /// /// Performs the operation in parallel using . /// The order in which the given function is applied to elements of the input array is not specified. /// The order of the keys and values in the result is also not specified - /// A function that transforms an element of the array into a comparable key. /// The input array. /// @@ -3391,9 +3391,10 @@ module Array = /// /// Evaluates to [| (1, [| 1; 3; 5 |]); (0, [| 2; 4 |]) |] /// + [] [] - val groupBy: projection:('T -> 'Key) -> array:'T[] -> ('Key * 'T[])[] when 'Key : equality + val groupBy: projection: ('T -> 'Key) -> array: 'T[] -> ('Key * 'T[])[] when 'Key: equality /// Apply the given function to each element of the array. /// @@ -3419,7 +3420,7 @@ module Array = /// /// [] - val iter: action:('T -> unit) -> array:'T[] -> unit + val iter: action: ('T -> unit) -> array: 'T[] -> unit /// Apply the given function to each element of the array. The integer passed to the /// function indicates the index of element. @@ -3446,8 +3447,8 @@ module Array = /// /// [] - val iteri: action:(int -> 'T -> unit) -> array:'T[] -> unit - + val iteri: action: (int -> 'T -> unit) -> array: 'T[] -> unit + /// Create an array given the dimension and a generator function to compute the elements. /// /// Performs the operation in parallel using . @@ -3465,9 +3466,9 @@ module Array = /// Evaluates to [| 5; 6; 7; 8 |] /// [] - val init: count:int -> initializer:(int -> 'T) -> 'T[] - - /// Split the collection into two collections, containing the + val init: count: int -> initializer: (int -> 'T) -> 'T[] + + /// Split the collection into two collections, containing the /// elements for which the given predicate returns "true" and "false" /// respectively /// @@ -3480,7 +3481,7 @@ module Array = /// The two arrays of results. /// /// Thrown when the input array is null. - /// + /// /// /// /// let inputs = [| 1; 2; 3; 4 |] @@ -3490,11 +3491,11 @@ module Array = /// Evaluates to ([|2; 4|], [|1; 3|]). /// [] - val partition: predicate:('T -> bool) -> array:'T[] -> 'T[] * 'T[] + val partition: predicate: ('T -> bool) -> array: 'T[] -> 'T[] * 'T[] /// Sorts the elements of an array in parallel, returning a new array. Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The input array. @@ -3502,7 +3503,7 @@ module Array = /// The sorted array. /// /// Thrown when the input array is null. - /// + /// /// /// /// let input = [| 8; 4; 3; 1; 6; 1 |] @@ -3513,12 +3514,12 @@ module Array = /// [] [] - val sort: array:'T[] -> 'T[] when 'T : comparison + val sort: array: 'T[] -> 'T[] when 'T: comparison - /// Sorts the elements of an array in parallel, using the given projection for the keys and returning a new array. + /// Sorts the elements of an array in parallel, using the given projection for the keys and returning a new array. /// Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The function to transform array elements into the type that is compared. @@ -3527,7 +3528,7 @@ module Array = /// The sorted array. /// /// Thrown when the input array is null. - /// + /// /// /// /// let input = [| "a"; "bbb"; "cccc"; "dd" |] @@ -3539,11 +3540,11 @@ module Array = [] [] - val sortBy: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison + val sortBy: projection: ('T -> 'Key) -> array: 'T[] -> 'T[] when 'Key: comparison /// Sorts the elements of an array in parallel, using the given comparison function as the order, returning a new array. /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The function to compare pairs of array elements. @@ -3552,7 +3553,7 @@ module Array = /// The sorted array. /// /// Thrown when the input array is null. - /// + /// /// Sort an array of pairs using a comparison function that compares string lengths then index numbers: /// /// let compareEntries (n1: int, s1: string) (n2: int, s2: string) = @@ -3568,19 +3569,19 @@ module Array = /// [] [] - val sortWith: comparer:('T -> 'T -> int) -> array:'T[] -> 'T[] + val sortWith: comparer: ('T -> 'T -> int) -> array: 'T[] -> 'T[] - /// Sorts the elements of an array by mutating the array in-place in parallel, using the given projection for the keys. + /// Sorts the elements of an array by mutating the array in-place in parallel, using the given projection for the keys. /// Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The function to transform array elements into the type that is compared. /// The input array. /// /// Thrown when the input array is null. - /// + /// /// /// /// let array = [| "a"; "bbb"; "cccc"; "dd" |] @@ -3591,7 +3592,7 @@ module Array = /// [] [] - val sortInPlaceBy: projection:('T -> 'Key) -> array:'T[] -> unit when 'Key : comparison + val sortInPlaceBy: projection: ('T -> 'Key) -> array: 'T[] -> unit when 'Key: comparison /// Sorts the elements of an array by mutating the array in-place in parallel, using the given comparison function as the order. /// @@ -3599,7 +3600,7 @@ module Array = /// The input array. /// /// Thrown when the input array is null. - /// + /// /// The following sorts entries using a comparison function that compares string lengths then index numbers: /// /// let compareEntries (n1: int, s1: string) (n2: int, s2: string) = @@ -3615,15 +3616,15 @@ module Array = /// [] [] - val sortInPlaceWith: comparer:('T -> 'T -> int) -> array:'T[] -> unit + val sortInPlaceWith: comparer: ('T -> 'T -> int) -> array: 'T[] -> unit - /// Sorts the elements of an array by mutating the array in-place in parallel, using the given comparison function. + /// Sorts the elements of an array by mutating the array in-place in parallel, using the given comparison function. /// Elements are compared using . /// /// The input array. /// /// Thrown when the input array is null. - /// + /// /// /// /// let array = [| 8; 4; 3; 1; 6; 1 |] @@ -3634,17 +3635,17 @@ module Array = /// [] [] - val sortInPlace: array:'T[] -> unit when 'T : comparison + val sortInPlace: array: 'T[] -> unit when 'T: comparison /// Sorts the elements of an array in parallel, in descending order, returning a new array. Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The input array. /// /// The sorted array. - /// + /// /// /// /// let input = [| 8; 4; 3; 1; 6; 1 |] @@ -3655,19 +3656,19 @@ module Array = /// [] [] - val sortDescending: array:'T[] -> 'T[] when 'T : comparison + val sortDescending: array: 'T[] -> 'T[] when 'T: comparison - /// Sorts the elements of an array in parallel, in descending order, using the given projection for the keys and returning a new array. + /// Sorts the elements of an array in parallel, in descending order, using the given projection for the keys and returning a new array. /// Elements are compared using . /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. /// For a stable sort, consider using . /// /// The function to transform array elements into the type that is compared. /// The input array. /// /// The sorted array. - /// + /// /// /// /// let input = [| "a"; "bbb"; "cccc"; "dd" |] @@ -3678,7 +3679,7 @@ module Array = /// [] [] - val sortByDescending: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison + val sortByDescending: projection: ('T -> 'Key) -> array: 'T[] -> 'T[] when 'Key: comparison /// Combines the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an ArgumentException is /// raised. @@ -3702,7 +3703,7 @@ module Array = /// [] [] - val zip: array1:'T1[] -> array2:'T2[] -> ('T1 * 'T2)[] + val zip: array1: 'T1[] -> array2: 'T2[] -> ('T1 * 'T2)[] /// Returns a new collection containing only the elements of the collection /// for which the given predicate returns true. @@ -3724,4 +3725,4 @@ module Array = /// [] [] - val filter: predicate:('T -> bool) -> array:'T[] -> 'T[] \ No newline at end of file + val filter: predicate: ('T -> bool) -> array: 'T[] -> 'T[] diff --git a/src/FSharp.Core/seq.fsi b/src/FSharp.Core/seq.fsi index d4451b6a8..9ce69ed5c 100644 --- a/src/FSharp.Core/seq.fsi +++ b/src/FSharp.Core/seq.fsi @@ -6,11 +6,11 @@ open System open System.Collections open Microsoft.FSharp.Core open Microsoft.FSharp.Collections - + /// Contains operations for working with values of type . [] [] -module Seq = +module Seq = /// Returns a new sequence that contains all pairings of elements from the first and second sequences. /// @@ -31,12 +31,12 @@ module Seq = /// /// [] - val allPairs: source1:seq<'T1> -> source2:seq<'T2> -> seq<'T1 * 'T2> + val allPairs: source1: seq<'T1> -> source2: seq<'T2> -> seq<'T1 * 'T2> /// Wraps the two given enumerations as a single concatenated /// enumeration. /// - /// The returned sequence may be passed between threads safely. However, + /// The returned sequence may be passed between threads safely. However, /// individual IEnumerator values generated from the returned sequence should not be accessed /// concurrently. /// @@ -55,7 +55,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 2; 3; 4 } /// [] - val append: source1:seq<'T> -> source2:seq<'T> -> seq<'T> + val append: source1: seq<'T> -> source2: seq<'T> -> seq<'T> /// Returns the average of the elements in the sequence. /// @@ -83,10 +83,11 @@ module Seq = /// Throws ArgumentException /// [] - val inline average : source:seq<(^T)> -> ^T - when ^T : (static member ( + ) : ^T * ^T -> ^T) - and ^T : (static member DivideByInt : ^T * int -> ^T) - and ^T : (static member Zero : ^T) + val inline average: + source: seq<(^T)> -> ^T + when ^T: (static member (+): ^T * ^T -> ^T) + and ^T: (static member DivideByInt: ^T * int -> ^T) + and ^T: (static member Zero: ^T) /// Returns the average of the results generated by applying the function to each element /// of the sequence. @@ -122,10 +123,11 @@ module Seq = /// Throws ArgumentException /// [] - val inline averageBy : projection:('T -> ^U) -> source:seq<'T> -> ^U - when ^U : (static member ( + ) : ^U * ^U -> ^U) - and ^U : (static member DivideByInt : ^U * int -> ^U) - and ^U : (static member Zero : ^U) + val inline averageBy: + projection: ('T -> ^U) -> source: seq<'T> -> ^U + when ^U: (static member (+): ^U * ^U -> ^U) + and ^U: (static member DivideByInt: ^U * int -> ^U) + and ^U: (static member Zero: ^U) /// Returns a sequence that corresponds to a cached version of the input sequence. /// @@ -168,7 +170,7 @@ module Seq = /// and it will not do the calculation again when called. /// [] - val cache: source:seq<'T> -> seq<'T> + val cache: source: seq<'T> -> seq<'T> /// Wraps a loosely-typed System.Collections sequence as a typed sequence. /// @@ -190,7 +192,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 2; 3 }, explicitly typed as seq<int>. /// [] - val cast: source:IEnumerable -> seq<'T> + val cast: source: IEnumerable -> seq<'T> /// Applies the given function to each element of the sequence. Returns /// a sequence comprised of the results "x" for each element where @@ -221,7 +223,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 2 } /// [] - val choose: chooser:('T -> 'U option) -> source:seq<'T> -> seq<'U> + val choose: chooser: ('T -> 'U option) -> source: seq<'T> -> seq<'U> /// Divides the input sequence into chunks of size at most chunkSize. /// @@ -247,7 +249,7 @@ module Seq = /// Throws ArgumentException /// [] - val chunkBySize: chunkSize:int -> source:seq<'T> -> seq<'T[]> + val chunkBySize: chunkSize: int -> source: seq<'T> -> seq<'T[]> /// Applies the given function to each element of the sequence and concatenates all the /// results. @@ -282,7 +284,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 2; 3; 4 } /// [] - val collect: mapping:('T -> 'Collection) -> source:seq<'T> -> seq<'U> when 'Collection :> seq<'U> + val collect: mapping: ('T -> 'Collection) -> source: seq<'T> -> seq<'U> when 'Collection :> seq<'U> /// Compares two sequences using the given comparison function, element by element. /// @@ -363,7 +365,7 @@ module Seq = /// Evaluates to -1 /// [] - val compareWith: comparer:('T -> 'T -> int) -> source1:seq<'T> -> source2:seq<'T> -> int + val compareWith: comparer: ('T -> 'T -> int) -> source1: seq<'T> -> source2: seq<'T> -> int /// Combines the given enumeration-of-enumerations as a single concatenated /// enumeration. @@ -386,7 +388,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 2; 3; 4; 5 } /// [] - val concat: sources:seq<'Collection> -> seq<'T> when 'Collection :> seq<'T> + val concat: sources: seq<'Collection> -> seq<'T> when 'Collection :> seq<'T> /// Tests if the sequence contains the specified element. /// @@ -404,7 +406,7 @@ module Seq = /// /// [] - val inline contains: value:'T -> source:seq<'T> -> bool when 'T : equality + val inline contains: value: 'T -> source: seq<'T> -> bool when 'T: equality /// Applies a key-generating function to each element of a sequence and returns a sequence yielding unique /// keys and their number of occurrences in the original sequence. @@ -433,7 +435,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { ("a", 2); ("b", 1) } /// [] - val countBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * int> when 'Key : equality + val countBy: projection: ('T -> 'Key) -> source: seq<'T> -> seq<'Key * int> when 'Key: equality /// Returns a sequence that is built from the given delayed specification of a /// sequence. @@ -452,7 +454,7 @@ module Seq = /// the generator function every time is consumed. /// [] - val delay: generator:(unit -> seq<'T>) -> seq<'T> + val delay: generator: (unit -> seq<'T>) -> seq<'T> /// Returns a sequence that contains no duplicate entries according to generic hash and /// equality comparisons on the entries. @@ -471,7 +473,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 2; 3 } /// [] - val distinct: source:seq<'T> -> seq<'T> when 'T : equality + val distinct: source: seq<'T> -> seq<'T> when 'T: equality /// Returns a sequence that contains no duplicate entries according to the /// generic hash and equality comparisons on the keys returned by the given key-generating function. @@ -493,7 +495,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { { Bar = 1 }; { Bar = 2 }; { Bar = 3 } } /// [] - val distinctBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : equality + val distinctBy: projection: ('T -> 'Key) -> source: seq<'T> -> seq<'T> when 'Key: equality /// Splits the input sequence into at most count chunks. /// @@ -528,7 +530,7 @@ module Seq = /// Throws ArgumentException /// [] - val splitInto: count:int -> source:seq<'T> -> seq<'T[]> + val splitInto: count: int -> source: seq<'T> -> seq<'T[]> /// Creates an empty sequence. /// @@ -569,7 +571,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 2; 4 } /// [] - val except: itemsToExclude:seq<'T> -> source:seq<'T> -> seq<'T> when 'T : equality + val except: itemsToExclude: seq<'T> -> source: seq<'T> -> seq<'T> when 'T: equality /// Tests if any element of the sequence satisfies the given predicate. /// @@ -602,7 +604,7 @@ module Seq = /// Evaluates to false /// [] - val exists: predicate:('T -> bool) -> source:seq<'T> -> bool + val exists: predicate: ('T -> bool) -> source: seq<'T> -> bool /// Tests if any pair of corresponding elements of the input sequences satisfies the given predicate. /// @@ -639,7 +641,7 @@ module Seq = /// Evaluates to true /// [] - val exists2: predicate:('T1 -> 'T2 -> bool) -> source1:seq<'T1> -> source2:seq<'T2> -> bool + val exists2: predicate: ('T1 -> 'T2 -> bool) -> source1: seq<'T1> -> source2: seq<'T2> -> bool /// Returns a new collection containing only the elements of the collection /// for which the given predicate returns "true". This is a synonym for Seq.where. @@ -665,7 +667,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 2; 4 } /// [] - val filter: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> + val filter: predicate: ('T -> bool) -> source: seq<'T> -> seq<'T> /// Returns a new collection containing only the elements of the collection /// for which the given predicate returns "true". @@ -691,7 +693,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 2; 4 } /// [] - val where: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> + val where: predicate: ('T -> bool) -> source: seq<'T> -> seq<'T> /// Returns the first element for which the given function returns True. /// @@ -722,7 +724,7 @@ module Seq = /// Throws KeyNotFoundException /// [] - val find: predicate:('T -> bool) -> source:seq<'T> -> 'T + val find: predicate: ('T -> bool) -> source: seq<'T> -> 'T /// Returns the last element for which the given function returns True. /// @@ -756,7 +758,7 @@ module Seq = /// Throws KeyNotFoundException /// [] - val findBack: predicate:('T -> bool) -> source:seq<'T> -> 'T + val findBack: predicate: ('T -> bool) -> source: seq<'T> -> 'T /// Returns the index of the first element for which the given function returns True. /// @@ -786,7 +788,7 @@ module Seq = /// Throws KeyNotFoundException /// [] - val findIndex: predicate:('T -> bool) -> source:seq<'T> -> int + val findIndex: predicate: ('T -> bool) -> source: seq<'T> -> int /// Returns the index of the last element for which the given function returns True. /// @@ -820,7 +822,7 @@ module Seq = /// Throws KeyNotFoundException /// [] - val findIndexBack: predicate:('T -> bool) -> source:seq<'T> -> int + val findIndexBack: predicate: ('T -> bool) -> source: seq<'T> -> int /// Applies a function to each element of the collection, threading an accumulator argument /// through the computation. If the input function is f and the elements are i0...iN @@ -850,7 +852,7 @@ module Seq = /// Evaluates to 2 /// [] - val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> 'State + val fold<'T, 'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> source: seq<'T> -> 'State /// Applies a function to corresponding elements of two collections, threading an accumulator argument /// through the computation. @@ -885,7 +887,8 @@ module Seq = /// Evaluates to 1 /// [] - val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> source1:seq<'T1> -> source2:seq<'T2> -> 'State + val fold2<'T1, 'T2, 'State> : + folder: ('State -> 'T1 -> 'T2 -> 'State) -> state: 'State -> source1: seq<'T1> -> source2: seq<'T2> -> 'State /// Applies a function to each element of the collection, starting from the end, threading an accumulator argument /// through the computation. If the input function is f and the elements are i0...iN @@ -930,7 +933,7 @@ module Seq = /// /// [] - val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> source:seq<'T> -> state:'State -> 'State + val foldBack<'T, 'State> : folder: ('T -> 'State -> 'State) -> source: seq<'T> -> state: 'State -> 'State /// Applies a function to corresponding elements of two collections, starting from the end of the shorter collection, /// threading an accumulator argument through the computation. The two sequences need not have equal lengths. @@ -982,7 +985,8 @@ module Seq = /// /// [] - val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> source1:seq<'T1> -> source2:seq<'T2> -> state:'State -> 'State + val foldBack2<'T1, 'T2, 'State> : + folder: ('T1 -> 'T2 -> 'State -> 'State) -> source1: seq<'T1> -> source2: seq<'T2> -> state: 'State -> 'State /// Tests if all elements of the sequence satisfy the given predicate. /// @@ -1007,7 +1011,7 @@ module Seq = /// /// [] - val forall: predicate:('T -> bool) -> source:seq<'T> -> bool + val forall: predicate: ('T -> bool) -> source: seq<'T> -> bool /// Tests the all pairs of elements drawn from the two sequences satisfy the /// given predicate. If one sequence is shorter than @@ -1041,7 +1045,7 @@ module Seq = /// Evaluates to false. /// [] - val forall2: predicate:('T1 -> 'T2 -> bool) -> source1:seq<'T1> -> source2:seq<'T2> -> bool + val forall2: predicate: ('T1 -> 'T2 -> bool) -> source1: seq<'T1> -> source2: seq<'T2> -> bool /// Applies a key-generating function to each element of a sequence and yields a sequence of /// unique keys. Each unique key contains a sequence of all elements that match @@ -1066,7 +1070,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { (1, seq { 1; 3; 5 }); (0, seq { 2; 4 }) } /// [] - val groupBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * seq<'T>> when 'Key : equality + val groupBy: projection: ('T -> 'Key) -> source: seq<'T> -> seq<'Key * seq<'T>> when 'Key: equality /// Returns the first element of the sequence. /// @@ -1093,7 +1097,7 @@ module Seq = /// Throws ArgumentException /// [] - val head: source:seq<'T> -> 'T + val head: source: seq<'T> -> 'T /// Returns the first element of the sequence, or None if the sequence is empty. /// @@ -1117,7 +1121,7 @@ module Seq = /// Evaluates to None /// [] - val tryHead: source:seq<'T> -> 'T option + val tryHead: source: seq<'T> -> 'T option /// Returns the last element of the sequence. /// @@ -1142,7 +1146,7 @@ module Seq = /// Throws ArgumentException /// [] - val last: source:seq<'T> -> 'T + val last: source: seq<'T> -> 'T /// Returns the last element of the sequence. /// Return None if no such element exists. @@ -1167,7 +1171,7 @@ module Seq = /// Evaluates to None /// [] - val tryLast: source:seq<'T> -> 'T option + val tryLast: source: seq<'T> -> 'T option /// Returns the only element of the sequence. /// @@ -1203,7 +1207,7 @@ module Seq = /// Throws ArgumentException /// [] - val exactlyOne: source:seq<'T> -> 'T + val exactlyOne: source: seq<'T> -> 'T /// Returns the only element of the sequence or None if sequence is empty or contains more than one element. /// @@ -1238,7 +1242,7 @@ module Seq = /// Evaluates to None /// [] - val tryExactlyOne: source:seq<'T> -> 'T option + val tryExactlyOne: source: seq<'T> -> 'T option /// Returns true if the sequence contains no elements, false otherwise. /// @@ -1262,7 +1266,7 @@ module Seq = /// Evaluates to false /// [] - val isEmpty: source:seq<'T> -> bool + val isEmpty: source: seq<'T> -> bool /// Builds a new collection whose elements are the corresponding elements of the input collection /// paired with the integer index (from 0) of each element. @@ -1280,7 +1284,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { (0, "a"); (1, "b"); (2, "c") } /// [] - val indexed: source:seq<'T> -> seq + val indexed: source: seq<'T> -> seq /// Generates a new sequence which, when iterated, will return successive /// elements by calling the given function, up to the given count. Each element is saved after its @@ -1311,7 +1315,7 @@ module Seq = /// Throws ArgumentException /// [] - val init: count:int -> initializer:(int -> 'T) -> seq<'T> + val init: count: int -> initializer: (int -> 'T) -> seq<'T> /// Generates a new sequence which, when iterated, will return successive /// elements by calling the given function. The results of calling the function @@ -1334,7 +1338,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 5; 6; 7; 8; ... } /// [] - val initInfinite: initializer:(int -> 'T) -> seq<'T> + val initInfinite: initializer: (int -> 'T) -> seq<'T> /// Computes the element at the specified index in the collection. /// @@ -1364,7 +1368,7 @@ module Seq = /// Throws ArgumentException /// [] - val item: index:int -> source:seq<'T> -> 'T + val item: index: int -> source: seq<'T> -> 'T /// Applies the given function to each element of the collection. /// @@ -1386,7 +1390,7 @@ module Seq = /// in the console. /// [] - val iter: action:('T -> unit) -> source:seq<'T> -> unit + val iter: action: ('T -> unit) -> source: seq<'T> -> unit /// Applies the given function to each element of the collection. The integer passed to the /// function indicates the index of element. @@ -1412,7 +1416,7 @@ module Seq = /// in the console. /// [] - val iteri: action:(int -> 'T -> unit) -> source:seq<'T> -> unit + val iteri: action: (int -> 'T -> unit) -> source: seq<'T> -> unit /// Applies the given function to two collections simultaneously. If one sequence is shorter than /// the other then the remaining elements of the longer sequence are ignored. @@ -1439,7 +1443,7 @@ module Seq = /// in the console. /// [] - val iter2: action:('T1 -> 'T2 -> unit) -> source1:seq<'T1> -> source2:seq<'T2> -> unit + val iter2: action: ('T1 -> 'T2 -> unit) -> source1: seq<'T1> -> source2: seq<'T2> -> unit /// Applies the given function to two collections simultaneously. If one sequence is shorter than /// the other then the remaining elements of the longer sequence are ignored. The integer passed to the @@ -1467,7 +1471,7 @@ module Seq = /// in the console. /// [] - val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> source1:seq<'T1> -> source2:seq<'T2> -> unit + val iteri2: action: (int -> 'T1 -> 'T2 -> unit) -> source1: seq<'T1> -> source2: seq<'T2> -> unit /// Returns the length of the sequence /// @@ -1486,7 +1490,7 @@ module Seq = /// Evaluates to 3 /// [] - val length: source:seq<'T> -> int + val length: source: seq<'T> -> int /// Builds a new collection whose elements are the results of applying the given function /// to each of the elements of the collection. The given function will be applied @@ -1512,7 +1516,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 3; 2 } /// [] - val map: mapping:('T -> 'U) -> source:seq<'T> -> seq<'U> + val map: mapping: ('T -> 'U) -> source: seq<'T> -> seq<'U> /// Builds a new collection whose elements are the results of applying the given function /// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than @@ -1536,7 +1540,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 'a'; 'd'; 'o' } /// [] - val map2: mapping:('T1 -> 'T2 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> seq<'U> + val map2: mapping: ('T1 -> 'T2 -> 'U) -> source1: seq<'T1> -> source2: seq<'T2> -> seq<'U> /// Combines map and fold. Builds a new collection whose elements are the results of applying the given function /// to each of the elements of the collection. The function is also used to accumulate a final value. @@ -1569,7 +1573,8 @@ module Seq = /// Evaluates newCharges to seq { In 2; Out 4; In 6 } and balance to 2. /// [] - val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:seq<'T> -> seq<'Result> * 'State + val mapFold<'T, 'State, 'Result> : + mapping: ('State -> 'T -> 'Result * 'State) -> state: 'State -> source: seq<'T> -> seq<'Result> * 'State /// Combines map and foldBack. Builds a new collection whose elements are the results of applying the given function /// to each of the elements of the collection. The function is also used to accumulate a final value. @@ -1602,7 +1607,8 @@ module Seq = /// Evaluates newCharges to seq { In 2; Out 4; In 6 } and balance to 2. /// [] - val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> source:seq<'T> -> state:'State -> seq<'Result> * 'State + val mapFoldBack<'T, 'State, 'Result> : + mapping: ('T -> 'State -> 'Result * 'State) -> source: seq<'T> -> state: 'State -> seq<'Result> * 'State /// Builds a new collection whose elements are the results of applying the given function /// to the corresponding triples of elements from the three sequences. If one input sequence if shorter than @@ -1627,9 +1633,10 @@ module Seq = /// /// Evaluates to a sequence yielding the same results as seq { "all"; "the"; "time" } /// - /// + /// [] - val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'U> + val map3: + mapping: ('T1 -> 'T2 -> 'T3 -> 'U) -> source1: seq<'T1> -> source2: seq<'T2> -> source3: seq<'T3> -> seq<'U> /// Builds a new collection whose elements are the results of applying the given function /// to each of the elements of the collection. The integer index passed to the @@ -1651,7 +1658,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 10; 11; 12 } /// [] - val mapi: mapping:(int -> 'T -> 'U) -> source:seq<'T> -> seq<'U> + val mapi: mapping: (int -> 'T -> 'U) -> source: seq<'T> -> seq<'U> /// Builds a new collection whose elements are the results of applying the given function /// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than @@ -1676,7 +1683,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { (0, 'a'); (1, 'd'); (2, 'o') } /// [] - val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> seq<'U> + val mapi2: mapping: (int -> 'T1 -> 'T2 -> 'U) -> source1: seq<'T1> -> source2: seq<'T2> -> seq<'U> /// Returns the greatest of all elements of the sequence, compared via Operators.max /// @@ -1705,7 +1712,7 @@ module Seq = /// Throws System.ArgumentException. /// [] - val inline max: source:seq<'T> -> 'T when 'T : comparison + val inline max: source: seq<'T> -> 'T when 'T: comparison /// Returns the greatest of all elements of the sequence, compared via Operators.max on the function result. /// @@ -1735,7 +1742,7 @@ module Seq = /// Throws System.ArgumentException. /// [] - val inline maxBy : projection:('T -> 'U) -> source:seq<'T> -> 'T when 'U : comparison + val inline maxBy: projection: ('T -> 'U) -> source: seq<'T> -> 'T when 'U: comparison /// Returns the lowest of all elements of the sequence, compared via Operators.min. /// @@ -1764,7 +1771,7 @@ module Seq = /// Throws System.ArgumentException. /// [] - val inline min: source:seq<'T> -> 'T when 'T : comparison + val inline min: source: seq<'T> -> 'T when 'T: comparison /// Returns the lowest of all elements of the sequence, compared via Operators.min on the function result. /// @@ -1794,7 +1801,7 @@ module Seq = /// Throws System.ArgumentException. /// [] - val inline minBy: projection:('T -> 'U) -> source:seq<'T> -> 'T when 'U : comparison + val inline minBy: projection: ('T -> 'U) -> source: seq<'T> -> 'T when 'U: comparison /// Computes the nth element in the collection. /// @@ -1807,7 +1814,7 @@ module Seq = /// Thrown when the index is negative or the input sequence does not contain enough elements. [] [] - val nth: index:int -> source:seq<'T> -> 'T + val nth: index: int -> source: seq<'T> -> 'T /// Views the given array as a sequence. /// @@ -1826,7 +1833,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 2; 5 }. /// [] - val ofArray: source:'T[] -> seq<'T> + val ofArray: source: 'T[] -> seq<'T> /// Views the given list as a sequence. /// @@ -1843,7 +1850,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 2; 5 }. /// [] - val ofList: source:'T list -> seq<'T> + val ofList: source: 'T list -> seq<'T> /// Returns a sequence of each element in the input sequence and its predecessor, with the /// exception of the first element which is only returned as the predecessor of the second element. @@ -1853,7 +1860,7 @@ module Seq = /// The result sequence. /// /// Thrown when the input sequence is null. - /// + /// /// /// /// let inputs = seq { 1; 2; 3; 4 } @@ -1863,7 +1870,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { (1, 2); (2, 3); (3, 4) }. /// [] - val pairwise: source:seq<'T> -> seq<'T * 'T> + val pairwise: source: seq<'T> -> seq<'T * 'T> /// Returns a sequence with all elements permuted according to the /// specified permutation. @@ -1877,7 +1884,7 @@ module Seq = /// /// Thrown when the input sequence is null. /// Thrown when indexMap does not produce a valid permutation. - /// + /// /// /// /// let inputs = [1; 2; 3; 4] @@ -1887,7 +1894,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 4; 1; 2; 3 }. /// [] - val permute: indexMap:(int -> int) -> source:seq<'T> -> seq<'T> + val permute: indexMap: (int -> int) -> source: seq<'T> -> seq<'T> /// Applies the given function to successive elements, returning the first /// x where the function returns "Some(x)". @@ -1920,7 +1927,7 @@ module Seq = /// /// [] - val pick: chooser:('T -> 'U option) -> source:seq<'T> -> 'U + val pick: chooser: ('T -> 'U option) -> source: seq<'T> -> 'U /// Builds a new sequence object that delegates to the given sequence object. This ensures /// the original sequence cannot be rediscovered and mutated by a type cast. For example, @@ -1953,7 +1960,7 @@ module Seq = /// Throws an InvalidCastException. /// [] - val readonly: source:seq<'T> -> seq<'T> + val readonly: source: seq<'T> -> seq<'T> /// Applies a function to each element of the sequence, threading an accumulator argument /// through the computation. Begin by applying the function to the first two elements. @@ -1968,7 +1975,7 @@ module Seq = /// /// Thrown when the input sequence is null. /// Thrown when the input sequence is empty. - /// + /// /// /// /// let inputs = [1; 3; 4; 2] @@ -1978,7 +1985,7 @@ module Seq = /// Evaluates to 1342, by computing ((1 * 10 + 3) * 10 + 4) * 10 + 2 /// [] - val reduce: reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T + val reduce: reduction: ('T -> 'T -> 'T) -> source: seq<'T> -> 'T /// Creates a sequence by replicating the given initial value. /// @@ -1986,7 +1993,7 @@ module Seq = /// The value to replicate /// /// The generated sequence. - /// + /// /// /// /// Seq.replicate 3 "a" @@ -1994,7 +2001,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { "a"; "a"; "a" }. /// [] - val replicate: count:int -> initial:'T -> seq<'T> + val replicate: count: int -> initial: 'T -> seq<'T> /// Applies a function to each element of the sequence, starting from the end, threading an accumulator argument /// through the computation. If the input function is f and the elements are i0...iN @@ -2010,7 +2017,7 @@ module Seq = /// Thrown when the input sequence is empty. /// /// This function consumes the whole input sequence before returning the result. - /// + /// /// /// /// let inputs = [1; 3; 4; 2] @@ -2020,7 +2027,7 @@ module Seq = /// Evaluates to 2431, by computing 1 + (3 + (4 + 2 * 10) * 10) * 10 /// [] - val reduceBack: reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T + val reduceBack: reduction: ('T -> 'T -> 'T) -> source: seq<'T> -> 'T /// Returns a new sequence with the elements in reverse order. /// @@ -2031,7 +2038,7 @@ module Seq = /// Thrown when the input sequence is null. /// /// This function consumes the whole input sequence before yielding the first element of the reversed sequence. - /// + /// /// /// /// let input = seq { 0; 1; 2 } @@ -2041,7 +2048,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 2; 1; 0 }. /// [] - val rev: source:seq<'T> -> seq<'T> + val rev: source: seq<'T> -> seq<'T> /// Like fold, but computes on-demand and returns the sequence of intermediary and final results. /// @@ -2052,7 +2059,7 @@ module Seq = /// The resulting sequence of computed states. /// /// Thrown when the input sequence is null. - /// + /// /// Apply a list charges and collect the running balances as each is applied: /// /// type Charge = @@ -2070,7 +2077,7 @@ module Seq = /// state, 1 the next state, -1 the next state, and 2 the final state. /// [] - val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> seq<'State> + val scan<'T, 'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> source: seq<'T> -> seq<'State> /// Like foldBack, but returns the sequence of intermediary and final results. /// @@ -2085,7 +2092,7 @@ module Seq = /// The resulting sequence of computed states. /// /// Thrown when the input sequence is null. - /// + /// /// Apply a list charges from back to front, and collect the running balances as each is applied: /// /// type Charge = @@ -2104,14 +2111,14 @@ module Seq = /// are produced from back to front. /// [] - val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> source:seq<'T> -> state:'State -> seq<'State> + val scanBack<'T, 'State> : folder: ('T -> 'State -> 'State) -> source: seq<'T> -> state: 'State -> seq<'State> /// Returns a sequence yielding one item only. /// /// The input item. /// /// The result sequence of one item. - /// + /// /// /// /// Seq.singleton 7 @@ -2119,7 +2126,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 7 }. /// [] - val singleton: value:'T -> seq<'T> + val singleton: value: 'T -> seq<'T> /// Returns a sequence that skips N elements of the underlying sequence and then yields the /// remaining elements of the sequence. @@ -2160,7 +2167,7 @@ module Seq = /// Evaluates a sequence yielding the same results as seq { "a"; "b"; "c"; "d" }. /// [] - val skip: count:int -> source:seq<'T> -> seq<'T> + val skip: count: int -> source: seq<'T> -> seq<'T> /// Returns a sequence that, when iterated, skips elements of the underlying sequence while the /// given predicate returns True, and then yields the remaining elements of the sequence. @@ -2181,7 +2188,7 @@ module Seq = /// Evaluates a sequence yielding the same results as seq { "bbb"; "cc"; "d" } /// [] - val skipWhile: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> + val skipWhile: predicate: ('T -> bool) -> source: seq<'T> -> seq<'T> /// Yields a sequence ordered by keys. /// @@ -2197,7 +2204,7 @@ module Seq = /// The result sequence. /// /// Thrown when the input sequence is null. - /// + /// /// /// /// let input = seq { 8; 4; 3; 1; 6; 1 } @@ -2207,7 +2214,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 1; 1 3; 4; 6; 8 }. /// [] - val sort: source:seq<'T> -> seq<'T> when 'T : comparison + val sort: source: seq<'T> -> seq<'T> when 'T: comparison /// Yields a sequence ordered using the given comparison function. /// @@ -2237,7 +2244,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { (0, "aa"); (2, "cc"); (3, "dd"); (1, "bbb") }. /// [] - val sortWith: comparer:('T -> 'T -> int) -> source:seq<'T> -> seq<'T> + val sortWith: comparer: ('T -> 'T -> int) -> source: seq<'T> -> seq<'T> /// Applies a key-generating function to each element of a sequence and yield a sequence ordered /// by keys. The keys are compared using generic comparison as implemented by . @@ -2255,7 +2262,7 @@ module Seq = /// The result sequence. /// /// Thrown when the input sequence is null. - /// + /// /// /// /// let input = [ "a"; "bbb"; "cccc"; "dd" ] @@ -2265,7 +2272,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { "a"; "dd"; "bbb"; "cccc" }. /// [] - val sortBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : comparison + val sortBy: projection: ('T -> 'Key) -> source: seq<'T> -> seq<'T> when 'Key: comparison /// Yields a sequence ordered descending by keys. /// @@ -2281,7 +2288,7 @@ module Seq = /// The result sequence. /// /// Thrown when the input sequence is null. - /// + /// /// /// /// let input = seq { 8; 4; 3; 1; 6; 1 } @@ -2291,7 +2298,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { 8; 6; 4; 3; 1; 1 }. /// [] - val inline sortDescending: source:seq<'T> -> seq<'T> when 'T : comparison + val inline sortDescending: source: seq<'T> -> seq<'T> when 'T: comparison /// Applies a key-generating function to each element of a sequence and yield a sequence ordered /// descending by keys. The keys are compared using generic comparison as implemented by . @@ -2309,7 +2316,7 @@ module Seq = /// The result sequence. /// /// Thrown when the input sequence is null. - /// + /// /// /// /// let input = ["a"; "bbb"; "cccc"; "dd"] @@ -2319,7 +2326,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { "cccc"; "bbb"; "dd"; "a" }. /// [] - val inline sortByDescending : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : comparison + val inline sortByDescending: projection: ('T -> 'Key) -> source: seq<'T> -> seq<'T> when 'Key: comparison /// Returns the sum of the elements in the sequence. /// @@ -2328,7 +2335,7 @@ module Seq = /// The input sequence. /// /// The computed sum. - /// + /// /// /// /// let input = [ 1; 5; 3; 2 ] @@ -2338,9 +2345,7 @@ module Seq = /// Evaluates to 11. /// [] - val inline sum: source:seq<(^T)> -> ^T - when ^T : (static member ( + ) : ^T * ^T -> ^T) - and ^T : (static member Zero : ^T) + val inline sum: source: seq<(^T)> -> ^T when ^T: (static member (+): ^T * ^T -> ^T) and ^T: (static member Zero: ^T) /// Returns the sum of the results generated by applying the function to each element of the sequence. /// @@ -2350,7 +2355,7 @@ module Seq = /// The input sequence. /// /// The computed sum. - /// + /// /// /// /// let input = [ "aa"; "bbb"; "cc" ] @@ -2360,9 +2365,9 @@ module Seq = /// Evaluates to 7. /// [] - val inline sumBy: projection:('T -> ^U) -> source:seq<'T> -> ^U - when ^U : (static member ( + ) : ^U * ^U -> ^U) - and ^U : (static member Zero : ^U) + val inline sumBy: + projection: ('T -> ^U) -> source: seq<'T> -> ^U + when ^U: (static member (+): ^U * ^U -> ^U) and ^U: (static member Zero: ^U) /// Returns a sequence that skips 1 element of the underlying sequence and then yields the /// remaining elements of the sequence. @@ -2384,7 +2389,7 @@ module Seq = /// /// [] - val tail: source:seq<'T> -> seq<'T> + val tail: source: seq<'T> -> seq<'T> /// Returns the first N elements of the sequence. /// @@ -2429,7 +2434,7 @@ module Seq = /// Evaluates to a sequence yielding no results. /// [] - val take: count:int -> source:seq<'T> -> seq<'T> + val take: count: int -> source: seq<'T> -> seq<'T> /// Returns a sequence that, when iterated, yields elements of the underlying sequence while the /// given predicate returns True, and then returns no further elements. @@ -2450,7 +2455,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { "a"; "bb" } /// [] - val takeWhile: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> + val takeWhile: predicate: ('T -> bool) -> source: seq<'T> -> seq<'T> /// Builds an array from the given collection. /// @@ -2469,7 +2474,7 @@ module Seq = /// Evaluates to [| 1; 2; 5 |]. /// [] - val toArray: source:seq<'T> -> 'T[] + val toArray: source: seq<'T> -> 'T[] /// Builds a list from the given collection. /// @@ -2488,7 +2493,7 @@ module Seq = /// Evaluates to [ 1; 2; 5 ]. /// [] - val toList: source:seq<'T> -> 'T list + val toList: source: seq<'T> -> 'T list /// Returns the first element for which the given function returns True. /// Return None if no such element exists. @@ -2518,7 +2523,7 @@ module Seq = /// Evaluates to None /// [] - val tryFind: predicate:('T -> bool) -> source:seq<'T> -> 'T option + val tryFind: predicate: ('T -> bool) -> source: seq<'T> -> 'T option /// Returns the last element for which the given function returns True. /// Return None if no such element exists. @@ -2551,7 +2556,7 @@ module Seq = /// Evaluates to None /// [] - val tryFindBack: predicate:('T -> bool) -> source:seq<'T> -> 'T option + val tryFindBack: predicate: ('T -> bool) -> source: seq<'T> -> 'T option /// Returns the index of the first element in the sequence /// that satisfies the given predicate. Return None if no such element exists. @@ -2581,7 +2586,7 @@ module Seq = /// Evaluates to None /// [] - val tryFindIndex : predicate:('T -> bool) -> source:seq<'T> -> int option + val tryFindIndex: predicate: ('T -> bool) -> source: seq<'T> -> int option /// Tries to find the nth element in the sequence. /// Returns None if index is negative or the input sequence does not contain enough elements. @@ -2610,7 +2615,7 @@ module Seq = /// Evaluates to None. /// [] - val tryItem: index:int -> source:seq<'T> -> 'T option + val tryItem: index: int -> source: seq<'T> -> 'T option /// Returns the index of the last element in the sequence /// that satisfies the given predicate. Return None if no such element exists. @@ -2643,7 +2648,7 @@ module Seq = /// Evaluates to None /// [] - val tryFindIndexBack : predicate:('T -> bool) -> source:seq<'T> -> int option + val tryFindIndexBack: predicate: ('T -> bool) -> source: seq<'T> -> int option /// Applies the given function to successive elements, returning the first /// result where the function returns "Some(x)". @@ -2673,7 +2678,7 @@ module Seq = /// Evaluates to None. /// [] - val tryPick: chooser:('T -> 'U option) -> source:seq<'T> -> 'U option + val tryPick: chooser: ('T -> 'U option) -> source: seq<'T> -> 'U option /// Returns the transpose of the given sequence of sequences. /// @@ -2698,7 +2703,7 @@ module Seq = /// Evaluates to a sequence of sequences yielding the same results as [ [10; 11]; [20; 21]; [30; 31] ]. /// [] - val transpose: source:seq<'Collection> -> seq> when 'Collection :> seq<'T> + val transpose: source: seq<'Collection> -> seq> when 'Collection :> seq<'T> /// Returns a sequence that when enumerated returns at most N elements. /// @@ -2736,7 +2741,7 @@ module Seq = /// Evaluates to the empty sequence. /// [] - val truncate: count:int -> source:seq<'T> -> seq<'T> + val truncate: count: int -> source: seq<'T> -> seq<'T> /// Returns a sequence that contains the elements generated by the given computation. /// The given initial state argument is passed to the element generator. @@ -2766,7 +2771,7 @@ module Seq = /// Evaluates to an infinite sequence yielding the results seq { 1I; 2I; 4I; 8I; ... } /// [] - val unfold: generator:('State -> ('T * 'State) option) -> state:'State -> seq<'T> + val unfold: generator: ('State -> ('T * 'State) option) -> state: 'State -> seq<'T> /// Returns a sequence yielding sliding windows containing elements drawn from the input /// sequence. Each window is returned as a fresh array. @@ -2777,7 +2782,7 @@ module Seq = /// The result sequence. /// Thrown when the input sequence is null. /// Thrown when windowSize is not positive. - /// + /// /// /// /// let inputs = [1; 2; 3; 4; 5] @@ -2787,7 +2792,7 @@ module Seq = /// Evaluates to a sequence of arrays yielding the results seq { [| 1; 2; 3 |]; [| 2; 3; 4 |]; [| 3; 4; 5 |] } /// [] - val windowed: windowSize:int -> source:seq<'T> -> seq<'T[]> + val windowed: windowSize: int -> source: seq<'T> -> seq<'T[]> /// Combines the two sequences into a sequence of pairs. The two sequences need not have equal lengths: /// when one sequence is exhausted any remaining elements in the other @@ -2810,7 +2815,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { (1, "one"); (2, "two") }. /// [] - val zip: source1:seq<'T1> -> source2:seq<'T2> -> seq<'T1 * 'T2> + val zip: source1: seq<'T1> -> source2: seq<'T2> -> seq<'T1 * 'T2> /// Combines the three sequences into a sequence of triples. The sequences need not have equal lengths: /// when one sequence is exhausted any remaining elements in the other @@ -2835,7 +2840,7 @@ module Seq = /// Evaluates to a sequence yielding the same results as seq { (1, "one", "I"); (2, "two", "II") }. /// [] - val zip3: source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'T1 * 'T2 * 'T3> + val zip3: source1: seq<'T1> -> source2: seq<'T2> -> source3: seq<'T3> -> seq<'T1 * 'T2 * 'T3> /// Return a new sequence with the item at a given index removed. /// diff --git a/src/FSharp.Core/tasks.fsi b/src/FSharp.Core/tasks.fsi index 8a13212d5..665041067 100644 --- a/src/FSharp.Core/tasks.fsi +++ b/src/FSharp.Core/tasks.fsi @@ -4,283 +4,284 @@ namespace Microsoft.FSharp.Control - open System - open System.Runtime.CompilerServices - open System.Threading.Tasks - open Microsoft.FSharp.Core - open Microsoft.FSharp.Core.CompilerServices - open Microsoft.FSharp.Collections +open System +open System.Runtime.CompilerServices +open System.Threading.Tasks +open Microsoft.FSharp.Core +open Microsoft.FSharp.Core.CompilerServices +open Microsoft.FSharp.Collections + +/// +/// The extra data stored in ResumableStateMachine for tasks +/// +[] +[] +type TaskStateMachineData<'T> = /// - /// The extra data stored in ResumableStateMachine for tasks + /// Holds the final result of the state machine /// - [] - [] - type TaskStateMachineData<'T> = + [] + val mutable Result: 'T - /// - /// Holds the final result of the state machine - /// - [] - val mutable Result: 'T + /// + /// Holds the MethodBuilder for the state machine + /// + [] + val mutable MethodBuilder: AsyncTaskMethodBuilder<'T> + +/// +/// This is used by the compiler as a template for creating state machine structs +/// +and [] TaskStateMachine<'TOverall> = + ResumableStateMachine> + +/// +/// Represents the runtime continuation of a task state machine created dynamically +/// +and [] TaskResumptionFunc<'TOverall> = ResumptionFunc> + +/// +/// A special compiler-recognised delegate type for specifying blocks of task code +/// with access to the state machine. +/// +and [] TaskCode<'TOverall, 'T> = ResumableCode, 'T> + +/// +/// Contains methods to build tasks using the F# computation expression syntax +/// +[] +type TaskBuilderBase = - /// - /// Holds the MethodBuilder for the state machine - /// - [] - val mutable MethodBuilder: AsyncTaskMethodBuilder<'T> + /// + /// Specifies the sequential composition of two units of task code. + /// + member inline Combine: task1: TaskCode<'TOverall, unit> * task2: TaskCode<'TOverall, 'T> -> TaskCode<'TOverall, 'T> /// - /// This is used by the compiler as a template for creating state machine structs + /// Specifies the delayed execution of a unit of task code. /// - and [] - TaskStateMachine<'TOverall> = ResumableStateMachine> + member inline Delay: generator: (unit -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> /// - /// Represents the runtime continuation of a task state machine created dynamically + /// Specifies the iterative execution of a unit of task code. /// - and [] - TaskResumptionFunc<'TOverall> = ResumptionFunc> + member inline For: sequence: seq<'T> * body: ('T -> TaskCode<'TOverall, unit>) -> TaskCode<'TOverall, unit> /// - /// A special compiler-recognised delegate type for specifying blocks of task code - /// with access to the state machine. + /// Specifies a unit of task code which returns a value /// - and [] - TaskCode<'TOverall, 'T> = ResumableCode, 'T> + member inline Return: value: 'T -> TaskCode<'T, 'T> /// - /// Contains methods to build tasks using the F# computation expression syntax + /// Specifies a unit of task code which excuted using try/finally semantics /// - [] - type TaskBuilderBase = - - /// - /// Specifies the sequential composition of two units of task code. - /// - member inline Combine: task1: TaskCode<'TOverall, unit> * task2: TaskCode<'TOverall, 'T> -> TaskCode<'TOverall, 'T> - - /// - /// Specifies the delayed execution of a unit of task code. - /// - member inline Delay: generator: (unit -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> - - /// - /// Specifies the iterative execution of a unit of task code. - /// - member inline For: sequence: seq<'T> * body: ('T -> TaskCode<'TOverall, unit>) -> TaskCode<'TOverall, unit> - - /// - /// Specifies a unit of task code which returns a value - /// - member inline Return: value: 'T -> TaskCode<'T, 'T> - - /// - /// Specifies a unit of task code which excuted using try/finally semantics - /// - member inline TryFinally: body: TaskCode<'TOverall, 'T> * [] compensation: (unit -> unit) -> TaskCode<'TOverall, 'T> - - /// - /// Specifies a unit of task code which excuted using try/with semantics - /// - member inline TryWith: body: TaskCode<'TOverall, 'T> * catch: (exn -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> - - #if NETSTANDARD2_1 - /// - /// Specifies a unit of task code which binds to the resource implementing IAsyncDisposable and disposes it asynchronously - /// - member inline Using<'Resource, 'TOverall, 'T when 'Resource :> IAsyncDisposable> : resource: 'Resource * body: ('Resource -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> - #endif + member inline TryFinally: + body: TaskCode<'TOverall, 'T> * [] compensation: (unit -> unit) -> TaskCode<'TOverall, 'T> - /// - /// Specifies the iterative execution of a unit of task code. - /// - member inline While: condition: (unit -> bool) * body: TaskCode<'TOverall, unit> -> TaskCode<'TOverall, unit> - - /// - /// Specifies a unit of task code which produces no result - /// - [] - member inline Zero: unit -> TaskCode<'TOverall, unit> + /// + /// Specifies a unit of task code which excuted using try/with semantics + /// + member inline TryWith: + body: TaskCode<'TOverall, 'T> * catch: (exn -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> +#if NETSTANDARD2_1 /// - /// Contains methods to build tasks using the F# computation expression syntax + /// Specifies a unit of task code which binds to the resource implementing IAsyncDisposable and disposes it asynchronously /// - [] - type TaskBuilder = - inherit TaskBuilderBase + member inline Using<'Resource, 'TOverall, 'T when 'Resource :> IAsyncDisposable> : + resource: 'Resource * body: ('Resource -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> +#endif - /// - /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. - /// - static member RunDynamic: code: TaskCode<'T, 'T> -> Task<'T> - - /// Hosts the task code in a state machine and starts the task. - member inline Run: code: TaskCode<'T, 'T> -> Task<'T> + /// + /// Specifies the iterative execution of a unit of task code. + /// + member inline While: condition: (unit -> bool) * body: TaskCode<'TOverall, unit> -> TaskCode<'TOverall, unit> + + /// + /// Specifies a unit of task code which produces no result + /// + [] + member inline Zero: unit -> TaskCode<'TOverall, unit> + +/// +/// Contains methods to build tasks using the F# computation expression syntax +/// +[] +type TaskBuilder = + inherit TaskBuilderBase /// - /// Contains methods to build tasks using the F# computation expression syntax + /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. /// - [] - type BackgroundTaskBuilder = - inherit TaskBuilderBase + static member RunDynamic: code: TaskCode<'T, 'T> -> Task<'T> + + /// Hosts the task code in a state machine and starts the task. + member inline Run: code: TaskCode<'T, 'T> -> Task<'T> + +/// +/// Contains methods to build tasks using the F# computation expression syntax +/// +[] +type BackgroundTaskBuilder = + inherit TaskBuilderBase + + /// + /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. + /// + static member RunDynamic: code: TaskCode<'T, 'T> -> Task<'T> + + /// + /// Hosts the task code in a state machine and starts the task, executing in the threadpool using Task.Run + /// + member inline Run: code: TaskCode<'T, 'T> -> Task<'T> + +/// Contains the `task` computation expression builder. +[] +module TaskBuilder = + + /// + /// Builds a task using computation expression syntax. + /// + /// + /// + val task: TaskBuilder + + /// + /// Builds a task using computation expression syntax which switches to execute on a background thread if not + /// already doing so. + /// + /// + /// + /// If the task is created on a foreground thread (where is non-null) + /// its body is executed on a background thread using . + /// If created on a background thread (where is null) it is executed immeidately + /// immediately on that thread. + /// + /// + /// + val backgroundTask: BackgroundTaskBuilder + +// Contains the `task` computation expression builder. +namespace Microsoft.FSharp.Control.TaskBuilderExtensions + +open System +open System.Runtime.CompilerServices +open System.Threading.Tasks +open Microsoft.FSharp.Core +open Microsoft.FSharp.Control +open Microsoft.FSharp.Core.CompilerServices + +/// +/// Contains low-priority overloads for the `task` computation expression builder. +/// +// +// Note: they are low priority because they are auto-opened first, and F# has a rule +// that extension method opened later in sequence get higher priority +// +// AutoOpen is by assembly attribute to get sequencing of AutoOpen correct and +// so each gives different priority +module LowPriority = + + type TaskBuilderBase with /// - /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. + /// Specifies a unit of task code which draws a result from a task-like value + /// satisfying the GetAwaiter pattern and calls a continuation. /// - static member RunDynamic: code: TaskCode<'T, 'T> -> Task<'T> + [] + member inline Bind< ^TaskLike, 'TResult1, 'TResult2, ^Awaiter, 'TOverall> : + task: ^TaskLike * continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) -> + TaskCode<'TOverall, 'TResult2> + when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) + and ^Awaiter :> ICriticalNotifyCompletion + and ^Awaiter: (member get_IsCompleted: unit -> bool) + and ^Awaiter: (member GetResult: unit -> 'TResult1) /// - /// Hosts the task code in a state machine and starts the task, executing in the threadpool using Task.Run + /// Specifies a unit of task code which draws its result from a task-like value + /// satisfying the GetAwaiter pattern. /// - member inline Run: code: TaskCode<'T, 'T> -> Task<'T> - - /// Contains the `task` computation expression builder. - [] - module TaskBuilder = + [] + member inline ReturnFrom< ^TaskLike, ^Awaiter, 'T> : + task: ^TaskLike -> TaskCode<'T, 'T> + when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) + and ^Awaiter :> ICriticalNotifyCompletion + and ^Awaiter: (member get_IsCompleted: unit -> bool) + and ^Awaiter: (member GetResult: unit -> 'T) /// - /// Builds a task using computation expression syntax. + /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. /// - /// - /// - val task: TaskBuilder + [] + static member inline BindDynamic< ^TaskLike, 'TResult1, 'TResult2, ^Awaiter, 'TOverall> : + sm: byref> * + task: ^TaskLike * + continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) -> + bool + when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) + and ^Awaiter :> ICriticalNotifyCompletion + and ^Awaiter: (member get_IsCompleted: unit -> bool) + and ^Awaiter: (member GetResult: unit -> 'TResult1) /// - /// Builds a task using computation expression syntax which switches to execute on a background thread if not - /// already doing so. + /// Specifies a unit of task code which binds to the resource implementing IDisposable and disposes it synchronously /// - /// - /// - /// If the task is created on a foreground thread (where is non-null) - /// its body is executed on a background thread using . - /// If created on a background thread (where is null) it is executed immeidately - /// immediately on that thread. - /// - /// - /// - val backgroundTask: BackgroundTaskBuilder - + member inline Using: + resource: 'Resource * body: ('Resource -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> + when 'Resource :> IDisposable -// Contains the `task` computation expression builder. -namespace Microsoft.FSharp.Control.TaskBuilderExtensions +/// +/// Contains medium-priority overloads for the `task` computation expression builder. +/// +module MediumPriority = - open System - open System.Runtime.CompilerServices - open System.Threading.Tasks - open Microsoft.FSharp.Core - open Microsoft.FSharp.Control - open Microsoft.FSharp.Core.CompilerServices + type TaskBuilderBase with - /// - /// Contains low-priority overloads for the `task` computation expression builder. - /// - // - // Note: they are low priority because they are auto-opened first, and F# has a rule - // that extension method opened later in sequence get higher priority - // - // AutoOpen is by assembly attribute to get sequencing of AutoOpen correct and - // so each gives different priority - module LowPriority = - - type TaskBuilderBase with - /// - /// Specifies a unit of task code which draws a result from a task-like value - /// satisfying the GetAwaiter pattern and calls a continuation. - /// - [] - member inline Bind< ^TaskLike, 'TResult1, 'TResult2, ^Awaiter, 'TOverall > : - task: ^TaskLike * - continuation: ( 'TResult1 -> TaskCode<'TOverall, 'TResult2>) - -> TaskCode<'TOverall, 'TResult2> - when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) - and ^Awaiter :> ICriticalNotifyCompletion - and ^Awaiter: (member get_IsCompleted: unit -> bool) - and ^Awaiter: (member GetResult: unit -> 'TResult1) - - /// - /// Specifies a unit of task code which draws its result from a task-like value - /// satisfying the GetAwaiter pattern. - /// - [] - member inline ReturnFrom< ^TaskLike, ^Awaiter, 'T> : - task: ^TaskLike - -> TaskCode< 'T, 'T > - when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) - and ^Awaiter :> ICriticalNotifyCompletion - and ^Awaiter: (member get_IsCompleted: unit -> bool) - and ^Awaiter: (member GetResult: unit -> 'T) - - /// - /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. - /// - [] - static member inline BindDynamic< ^TaskLike, 'TResult1, 'TResult2, ^Awaiter, 'TOverall > : - sm: byref> * - task: ^TaskLike * - continuation: ( 'TResult1 -> TaskCode<'TOverall, 'TResult2>) - -> bool - when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) - and ^Awaiter :> ICriticalNotifyCompletion - and ^Awaiter: (member get_IsCompleted: unit -> bool) - and ^Awaiter: (member GetResult: unit -> 'TResult1) - - /// - /// Specifies a unit of task code which binds to the resource implementing IDisposable and disposes it synchronously - /// - member inline Using: - resource: 'Resource * - body: ('Resource -> TaskCode<'TOverall, 'T>) - -> TaskCode<'TOverall, 'T> when 'Resource :> IDisposable + /// + /// Specifies a unit of task code which draws a result from an F# async value then calls a continuation. + /// + member inline Bind: + computation: Async<'TResult1> * continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) -> + TaskCode<'TOverall, 'TResult2> - /// - /// Contains medium-priority overloads for the `task` computation expression builder. - /// - module MediumPriority = + /// + /// Specifies a unit of task code which draws a result from an F# async value. + /// + member inline ReturnFrom: computation: Async<'T> -> TaskCode<'T, 'T> - type TaskBuilderBase with +/// +/// Contains high-priority overloads for the `task` computation expression builder. +/// +module HighPriority = - /// - /// Specifies a unit of task code which draws a result from an F# async value then calls a continuation. - /// - member inline Bind: - computation: Async<'TResult1> * - continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) - -> TaskCode<'TOverall, 'TResult2> + type TaskBuilderBase with - /// - /// Specifies a unit of task code which draws a result from an F# async value. - /// - member inline ReturnFrom: - computation: Async<'T> - -> TaskCode<'T, 'T> + /// + /// Specifies a unit of task code which draws a result from a task then calls a continuation. + /// + member inline Bind: + task: Task<'TResult1> * continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) -> + TaskCode<'TOverall, 'TResult2> - /// - /// Contains high-priority overloads for the `task` computation expression builder. - /// - module HighPriority = - - type TaskBuilderBase with - /// - /// Specifies a unit of task code which draws a result from a task then calls a continuation. - /// - member inline Bind: - task: Task<'TResult1> * - continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) - -> TaskCode<'TOverall, 'TResult2> - - /// - /// Specifies a unit of task code which draws a result from a task. - /// - member inline ReturnFrom: - task: Task<'T> - -> TaskCode<'T, 'T> - - /// - /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. - /// - static member BindDynamic: - sm: byref> * - task: Task<'TResult1> * - continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) - -> bool + /// + /// Specifies a unit of task code which draws a result from a task. + /// + member inline ReturnFrom: task: Task<'T> -> TaskCode<'T, 'T> + + /// + /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. + /// + static member BindDynamic: + sm: byref> * + task: Task<'TResult1> * + continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) -> + bool -- GitLab