From b4a5471eaf9b5169d792dc56a1b35c0c6e9b6ce0 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 06:55:12 +0100 Subject: [PATCH 01/15] fixes in Result --- src/FSharpPlus/Extensions/Result.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/FSharpPlus/Extensions/Result.fs b/src/FSharpPlus/Extensions/Result.fs index 371319768..629508fdf 100644 --- a/src/FSharpPlus/Extensions/Result.fs +++ b/src/FSharpPlus/Extensions/Result.fs @@ -18,6 +18,7 @@ module Result = /// Creates a Result value from a pair of Result values, using a function to combine them. + /// The mapping function. /// The first Result value. /// The second Result value. /// @@ -25,6 +26,7 @@ module Result = let map2 f (x: Result<'T,'Error>) (y: Result<'U,'Error>) : Result<'V,'Error> = match x, y with Ok a, Ok b -> Ok (f a b) | Error e, _ | _, Error e -> Error e /// Creates a Result value from three Result values, using a function to combine them. + /// The mapping function. /// The first Result value. /// The second Result value. /// The third Result value. @@ -41,7 +43,7 @@ module Result = /// The nested Results. /// A single Ok of the value when it was nested with OKs, or the Error. /// flatten is equivalent to bind id. - let flatten x : Result<'T,'Error> = match x with Ok (Ok v) -> Ok v | Ok (Error e) | Error e -> Error e + let flatten source : Result<'T,'Error> = match source with Ok (Ok v) -> Ok v | Ok (Error e) | Error e -> Error e [] let inline catch f = function Ok v -> Ok v | Error e -> (f: 't->_) e : Result<'v,'e> From 027144378d629cf855cd390bebbc6826c8fc26a8 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:01:09 +0100 Subject: [PATCH 02/15] fixes in Choice --- src/FSharpPlus/Extensions/Choice.fs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/FSharpPlus/Extensions/Choice.fs b/src/FSharpPlus/Extensions/Choice.fs index af829b621..7862e4df1 100644 --- a/src/FSharpPlus/Extensions/Choice.fs +++ b/src/FSharpPlus/Extensions/Choice.fs @@ -24,21 +24,27 @@ module Choice = let map (mapping: 'T->'U) (source: Choice<'T,'T2>) = match source with Choice1Of2 v -> Choice1Of2 (mapping v) | Choice2Of2 e -> Choice2Of2 e /// Creates a Choice value from a pair of Choice values, using a function to combine the Choice1Of2 values. + /// A function to apply to the Choice1Of2 values. /// The first Choice value. /// The second Choice value. /// /// The combined value, or the first Choice2Of2. - let map2 f (x: Choice<'T,'Error>) (y: Choice<'U,'Error>) : Choice<'V,'Error> = match x, y with Choice1Of2 a, Choice1Of2 b -> Choice1Of2 (f a b) | Choice2Of2 e, _ | _, Choice2Of2 e -> Choice2Of2 e + let map2 mapping (x: Choice<'T,'Error>) (y: Choice<'U,'Error>) : Choice<'V,'Error> = + match x, y with + | Choice1Of2 a, Choice1Of2 b -> Choice1Of2 (mapping a b) + | Choice2Of2 e, _ + | _, Choice2Of2 e -> Choice2Of2 e /// Creates a Choice value from three of Choice values, using a function to combine the Choice1Of2 values. + /// A function to apply to the Choice1Of2 values. /// The first Choice value. /// The second Choice value. /// The third Choice value. /// /// The combined value, or the first Choice2Of2. - let map3 f (x: Choice<'T,'Error>) (y: Choice<'U,'Error>) (z: Choice<'V, 'Error>) : Choice<'W,'Error> = + let map3 mapping (x: Choice<'T,'Error>) (y: Choice<'U,'Error>) (z: Choice<'V, 'Error>) : Choice<'W,'Error> = match x, y, z with - | Choice1Of2 a, Choice1Of2 b, Choice1Of2 c -> Choice1Of2 (f a b c) + | Choice1Of2 a, Choice1Of2 b, Choice1Of2 c -> Choice1Of2 (mapping a b c) | Choice2Of2 e, _ , _ | _ , Choice2Of2 e, _ | _ , _ , Choice2Of2 e -> Choice2Of2 e From 4d84359251b30e1634a8c3bccb31b57487a5e0c1 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:05:15 +0100 Subject: [PATCH 03/15] fixes in Seq --- src/FSharpPlus/Extensions/Seq.fs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/FSharpPlus/Extensions/Seq.fs b/src/FSharpPlus/Extensions/Seq.fs index 7c4b7637c..b69948da3 100644 --- a/src/FSharpPlus/Extensions/Seq.fs +++ b/src/FSharpPlus/Extensions/Seq.fs @@ -167,10 +167,10 @@ module Seq = /// The input sequence. /// /// The result sequence. - let drop i (source: seq<_>) = - let mutable count = i + let drop count (source: seq<_>) = + let mutable i = count use e = source.GetEnumerator () - while (count > 0 && e.MoveNext ()) do count <- count-1 + while (i > 0 && e.MoveNext ()) do i <- i-1 seq { while e.MoveNext () do yield e.Current } #if !FABLE_COMPILER @@ -243,10 +243,10 @@ module Seq = #endif /// Choose with access to the index - /// The mapping function, taking index and element as parameters. - /// The input seq. + /// The mapping function, taking index and element as parameters. + /// The input seq. /// /// Seq with values x for each List value where the function returns Some(x). - let choosei f l = - Seq.indexed l - |> Seq.choose (fun (a, b) -> f a b) \ No newline at end of file + let choosei mapping source = + Seq.indexed source + |> Seq.choose (fun (a, b) -> mapping a b) From 407d0508a2f78ff9300c454c2aad92bbe52cbc81 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:11:13 +0100 Subject: [PATCH 04/15] fixes in List --- src/FSharpPlus/Extensions/List.fs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/FSharpPlus/Extensions/List.fs b/src/FSharpPlus/Extensions/List.fs index 924afb406..845555b8f 100644 --- a/src/FSharpPlus/Extensions/List.fs +++ b/src/FSharpPlus/Extensions/List.fs @@ -64,12 +64,12 @@ module List = /// The input list. /// /// The result list. - let drop i list = + let drop count source = let rec loop i lst = match lst, i with | [] as x, _ | x, 0 -> x | x, n -> loop (n-1) (List.tail x) - if i > 0 then loop i list else list + if i > 0 then loop count source else source /// Concatenates all elements, using the specified separator between each element. let intercalate (separator: list<_>) (source: seq>) = source |> Seq.intercalate separator |> Seq.toList @@ -151,26 +151,26 @@ module List = /// /// Zip safely two lists. If one list is shorter, excess elements are discarded from the right end of the longer list. /// - /// First input list. - /// Second input list. + /// First input list. + /// Second input list. /// List with corresponding pairs of input lists. - let zipShortest (l1: list<'T1>) (l2: list<'T2>) = + let zipShortest (list1: list<'T1>) (list2: list<'T2>) = let rec loop acc = function - | (l::ls,r::rs) -> loop ((l,r)::acc) (ls,rs) - | (_,_) -> acc - loop [] (l1,l2) |> List.rev + | (l::ls, r::rs) -> loop ((l, r)::acc) (ls, rs) + | (_, _) -> acc + loop [] (list1, list2) |> List.rev /// Same as choose but with access to the index. - /// The mapping function, taking index and element as parameters. - /// The input list. + /// The mapping function, taking index and element as parameters. + /// The input list. /// /// List with values x for each List value where the function returns Some(x). - let choosei f a = + let choosei mapping source = let mutable i = ref -1 let fi x = incr i - f !i x - List.choose fi a + mapping !i x + List.choose fi source /// Attempts to remove an item from a list. /// The index of the item to remove @@ -191,4 +191,4 @@ module List = let setAt i x lst = if List.length lst > i && i >= 0 then lst.[0..i-1] @ x::lst.[i+1..] - else lst \ No newline at end of file + else lst From 501622ef67d71293205552b2fae3de66b97f84e4 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:42:11 +0100 Subject: [PATCH 05/15] fix --- src/FSharpPlus/Extensions/List.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FSharpPlus/Extensions/List.fs b/src/FSharpPlus/Extensions/List.fs index 845555b8f..d0a880057 100644 --- a/src/FSharpPlus/Extensions/List.fs +++ b/src/FSharpPlus/Extensions/List.fs @@ -69,7 +69,7 @@ module List = match lst, i with | [] as x, _ | x, 0 -> x | x, n -> loop (n-1) (List.tail x) - if i > 0 then loop count source else source + if count > 0 then loop count source else source /// Concatenates all elements, using the specified separator between each element. let intercalate (separator: list<_>) (source: seq>) = source |> Seq.intercalate separator |> Seq.toList From 11799bd21e97e819a2c5e8636bc1531701251c63 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:46:13 +0100 Subject: [PATCH 06/15] fix Array --- src/FSharpPlus/Extensions/Array.fs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/FSharpPlus/Extensions/Array.fs b/src/FSharpPlus/Extensions/Array.fs index 4f782ebab..49200f8ab 100644 --- a/src/FSharpPlus/Extensions/Array.fs +++ b/src/FSharpPlus/Extensions/Array.fs @@ -28,18 +28,18 @@ module Array = /// Combines all values from three arrays and calls a mapping function on this combination. - /// Mapping function taking three element combination as input. - /// First array. - /// Second array. - /// Third array. + /// Mapping function taking three element combination as input. + /// First array. + /// Second array. + /// Third array. /// /// Array with values returned from mapping function. - let lift3 f x y z = - let lenx, leny, lenz = Array.length x, Array.length y, Array.length z - let combinedFirstTwo = Array.init (lenx * leny) (fun i -> (x.[i / leny], y.[i % leny])) + let lift3 mapping list1 list2 list3 = + let lenx, leny, lenz = Array.length list1, Array.length list2, Array.length list3 + let combinedFirstTwo = Array.init (lenx * leny) (fun i -> (list1.[i / leny], list2.[i % leny])) - Array.init (lenx * leny * lenz) (fun i -> combinedFirstTwo.[i/leny], z.[i%leny]) - |> Array.map (fun x -> f (fst (fst x)) (snd (fst x)) (snd x)) + Array.init (lenx * leny * lenz) (fun i -> combinedFirstTwo.[i/leny], list3.[i%leny]) + |> Array.map (fun x -> mapping (fst (fst x)) (snd (fst x)) (snd x)) /// Concatenates all elements, using the specified separator between each element. let intercalate (separator: _ []) (source: seq<_ []>) = source |> Seq.intercalate separator |> Seq.toArray @@ -118,13 +118,13 @@ module Array = Array.init (min a1.Length a2.Length) (fun i -> a1.[i], a2.[i]) /// Same as choose but with access to the index. - /// The mapping function, taking index and element as parameters. - /// The input array. + /// The mapping function, taking index and element as parameters. + /// The input array. /// /// Array with values x for each Array value where the function returns Some(x). - let choosei f a = + let choosei mapping source = let mutable i = ref -1 let fi x = incr i - f !i x - Array.choose fi a \ No newline at end of file + mapping !i x + Array.choose fi source From 32cf8567164cd09f4149a6aecda8e6a6e0945842 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:47:53 +0100 Subject: [PATCH 07/15] fix ResizeArray --- src/FSharpPlus/Extensions/ResizeArray.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FSharpPlus/Extensions/ResizeArray.fs b/src/FSharpPlus/Extensions/ResizeArray.fs index 21c6198e7..8504a72c7 100644 --- a/src/FSharpPlus/Extensions/ResizeArray.fs +++ b/src/FSharpPlus/Extensions/ResizeArray.fs @@ -15,7 +15,7 @@ module ResizeArray = /// The result ResizeArray. /// /// Thrown when the input ResizeArray is null. - let map (f: 'T->'U) (x: ResizeArray<'T>) = ResizeArray (Seq.map f x) + let map (mapping: 'T->'U) (source: ResizeArray<'T>) = ResizeArray (Seq.map mapping source) /// Applies a ResizeArray of functions to a ResizeArray of values and concatenates them. /// The functions. @@ -34,7 +34,7 @@ module ResizeArray = let lift2 mapping (x1: ResizeArray<'T>) (x2: ResizeArray<'U>) = ResizeArray (Seq.lift2 mapping x1 x2) /// Combines values from three ResizeArrays and calls a mapping function on this combination. - /// Mapping function taking three element combination as input. + /// Mapping function taking three element combination as input. /// First ResizeArray. /// Second ResizeArray. /// Third ResizeArray. From 442cbe7861bd3cd6e2cc6b63d21ac1e16a9f8343 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:52:57 +0100 Subject: [PATCH 08/15] fix Lazy --- src/FSharpPlus/Extensions/Lazy.fs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/FSharpPlus/Extensions/Lazy.fs b/src/FSharpPlus/Extensions/Lazy.fs index 213d3a5ad..1b8c67a5d 100644 --- a/src/FSharpPlus/Extensions/Lazy.fs +++ b/src/FSharpPlus/Extensions/Lazy.fs @@ -5,21 +5,31 @@ module Lazy = /// Creates a Lazy value from another Lazy value, mapping through a function. + /// The mapping function. + /// The Lazy value. + /// + /// The mappeed value. let map (mapping: 'T -> 'U) (x: Lazy<'T>) = Lazy<_>.Create (fun () -> mapping x.Value) : Lazy<'U> /// Creates a Lazy value from a pair of Lazy values, using a mapping function to combine them. + /// The mapping function. + /// The first Lazy value. + /// The second Lazy value. + /// + /// The combined value. let map2 (mapping: 'T->'U->'V) (x: Lazy<'T>) (y: Lazy<'U>) = Lazy<_>.Create (fun () -> mapping x.Value y.Value) /// Creates a Lazy value from three Lazy values, using a function to combine them. + /// The mapping function. /// The first Lazy value. /// The second Lazy value. /// The third Lazy value. /// /// The combined value. - let map3 (f: 'T->'U->'V->'W) (x: Lazy<'T>) (y: Lazy<'U>) (z: Lazy<'V>) = Lazy<_>.Create (fun () -> f x.Value y.Value z.Value) + let map3 (mapping: 'T->'U->'V->'W) (x: Lazy<'T>) (y: Lazy<'U>) (z: Lazy<'V>) = Lazy<_>.Create (fun () -> mapping x.Value y.Value z.Value) /// Applies a Lazy value to a Lazy function. /// The Lazy function. /// The Lazy value. /// A Lazy value of the function applied to the value. - let apply (f: Lazy<'T->'U>) (x: Lazy<'T>) : Lazy<'U> = Lazy<_>.Create (fun () -> f.Value x.Value) \ No newline at end of file + let apply (f: Lazy<'T->'U>) (x: Lazy<'T>) : Lazy<'U> = Lazy<_>.Create (fun () -> f.Value x.Value) From be887d63fb0514e02929aeb54e613915cf4cdae8 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:56:19 +0100 Subject: [PATCH 09/15] fix Map --- src/FSharpPlus/Extensions/Map.fs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/FSharpPlus/Extensions/Map.fs b/src/FSharpPlus/Extensions/Map.fs index 439913934..2cca37334 100644 --- a/src/FSharpPlus/Extensions/Map.fs +++ b/src/FSharpPlus/Extensions/Map.fs @@ -3,10 +3,13 @@ namespace FSharpPlus /// Additional operations on Map<'Key, 'Value> [] module Map = + open System.Collections.Generic + #if !FABLE_COMPILER open System.Linq + #endif /// Returns the keys of the given map. @@ -48,27 +51,27 @@ module Map = /// Combines values from three maps using mapping function. /// Keys that are not present on every Map are dropped. - /// The mapping function. + /// The mapping function. /// First input Map. /// Second input Map. - /// Third input Map. + /// Third input Map. /// /// The mapped Map. - let mapValues3 f (x: Map<'Key, 'T1>) (y: Map<'Key, 'T2>) (z: Map<'Key, 'T3>) = Map <| seq { - let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt f + let mapValues3 mapping (x: Map<'Key, 'T1>) (y: Map<'Key, 'T2>) (z: Map<'Key, 'T3>) = Map <| seq { + let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt mapping for KeyValue(k, vx) in x do match Map.tryFind k y, lazy Map.tryFind k z with | Some vy, Lazy (Some vz) -> yield (k, f.Invoke (vx, vy, vz)) | _ , _ -> () } /// Applies given function to each value of the given Map. - /// The mapping function. - /// The input Map. + /// The mapping function. + /// The input Map. /// /// Returns Map with values x for each Map value where the function returns Some(x). - let chooseValues f (x: Map<'Key, 'T>) = Map <| seq { - for KeyValue(k, v) in x do - match f v with + let chooseValues mapping (source: Map<'Key, 'T>) = Map <| seq { + for KeyValue(k, v) in source do + match mapping v with | Some v -> yield (k, v) | None -> () } From 3f170a994f81bc1b9ef2a23636b49101a7ec0961 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:58:21 +0100 Subject: [PATCH 10/15] fix Dictionary --- src/FSharpPlus/Extensions/Dictionary.fs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/FSharpPlus/Extensions/Dictionary.fs b/src/FSharpPlus/Extensions/Dictionary.fs index 9d68744b4..ceb10004f 100644 --- a/src/FSharpPlus/Extensions/Dictionary.fs +++ b/src/FSharpPlus/Extensions/Dictionary.fs @@ -49,25 +49,26 @@ module Dictionary = let values (source: Dictionary<_,_>) = Seq.map (fun (KeyValue(_, v)) -> v) source /// Maps the given function over each value in the dictionary. - /// The mapping function. + /// The mapping function. /// The input dictionary. /// /// The mapped dictionary. - let map f (x: Dictionary<'Key, 'T>) = + let map mapping (x: Dictionary<'Key, 'T>) = let dct = Dictionary<'Key, 'U> () for KeyValue(k, v) in x do - dct.Add (k, f v) + dct.Add (k, mapping v) dct /// Creates a Dictionary value from a pair of Dictionaries, using a function to combine them. /// Keys that are not present on both dictionaries are dropped. + /// The mapping function. /// The first input dictionary. /// The second input dictionary. /// /// The combined dictionary. - let map2 f (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) = + let map2 mapping (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) = let dct = Dictionary<'Key, 'U> () - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt mapping for KeyValue(k, vx) in x do match tryGetValue k y with | Some vy -> dct.Add (k, f.Invoke (vx, vy)) @@ -76,15 +77,15 @@ module Dictionary = /// Combines values from three Dictionaries using mapping function. /// Keys that are not present on every Dictionary are dropped. - /// The mapping function. + /// The mapping function. /// First input Dictionary. /// Second input Dictionary. - /// Third input Dictionary. + /// Third input Dictionary. /// /// The mapped Dictionary. - let map3 f (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) (z: Dictionary<'Key, 'T3>) = + let map3 mapping (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) (z: Dictionary<'Key, 'T3>) = let dct = Dictionary<'Key, 'U> () - let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt f + let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt mapping for KeyValue(k, vx) in x do match tryGetValue k y, tryGetValue k z with | Some vy, Some vz -> dct.Add (k, f.Invoke (vx, vy, vz)) @@ -178,4 +179,4 @@ module Dictionary = match f k v with | Some v -> dct.Add (k, v) | None -> () - dct \ No newline at end of file + dct From efec40aa0b81f116a1e2adceca6ae09848559107 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 08:19:32 +0100 Subject: [PATCH 11/15] fix NonEmptyList --- src/FSharpPlus/Data/NonEmptyList.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FSharpPlus/Data/NonEmptyList.fs b/src/FSharpPlus/Data/NonEmptyList.fs index 1be815c37..3e284df59 100644 --- a/src/FSharpPlus/Data/NonEmptyList.fs +++ b/src/FSharpPlus/Data/NonEmptyList.fs @@ -108,8 +108,8 @@ module NonEmptyList = /// /// Zip safely two lists. If one list is shorter, excess elements are discarded from the right end of the longer list. /// - /// First input list. - /// Second input list. + /// First input list. + /// Second input list. /// List with corresponding pairs of input lists. let zipShortest (list1: NonEmptyList<'T>) (list2: NonEmptyList<'U>) = { Head = (list1.Head, list2.Head); Tail = List.zipShortest list1.Tail list2.Tail } From 935ada23422d4112bed520ecdd54f32bc2ca757b Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 08:20:58 +0100 Subject: [PATCH 12/15] fix NonEmptySeq --- src/FSharpPlus/Data/NonEmptySeq.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FSharpPlus/Data/NonEmptySeq.fs b/src/FSharpPlus/Data/NonEmptySeq.fs index 0f460c8fb..3a458211f 100644 --- a/src/FSharpPlus/Data/NonEmptySeq.fs +++ b/src/FSharpPlus/Data/NonEmptySeq.fs @@ -287,7 +287,7 @@ module NonEmptySeq = else Some (unsafeOfArray array) /// Builds a non empty sequence from the given list. - /// The input list. + /// The input list. /// Non empty sequence containing the elements of the list. /// Thrown when the input list is empty. /// Throws exception for empty list @@ -391,7 +391,7 @@ module NonEmptySeq = /// /// This is a stable sort, that is the original order of equal elements is preserved. /// The function to compare the collection elements. - /// The input sequence. + /// The input sequence. /// The result sequence. /// This function consumes the whole input sequence before yielding the first element of the result sequence. let sortWith comparer (source: NonEmptySeq<_>) = Seq.sortWith comparer source |> unsafeOfSeq @@ -528,4 +528,4 @@ module NonEmptySeqBuilder = member __.Yield x = NonEmptySeq.singleton x member __.Delay expr = expr () : NonEmptySeq<'T> - let neseq = NESeqBuilder () \ No newline at end of file + let neseq = NESeqBuilder () From 1689042f070f99fe94525b32fe9963f6b9f32ac7 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 08:23:06 +0100 Subject: [PATCH 13/15] fix Operators --- src/FSharpPlus/Operators.fs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs index 8dc6cb30f..d7afdd8a8 100644 --- a/src/FSharpPlus/Operators.fs +++ b/src/FSharpPlus/Operators.fs @@ -540,14 +540,14 @@ module Operators = /// /// The input foldable. /// The list of foldable elements. - let inline toList value : 'T list = ToList.Invoke value + let inline toList source : 'T list = ToList.Invoke source /// Builds an array from the given foldable. /// Foldable /// /// The input foldable. /// The array of foldable elements. - let inline toArray value : 'T [] = ToArray.Invoke value + let inline toArray source : 'T [] = ToArray.Invoke source /// Views the given foldable as a sequence. /// Foldable @@ -654,7 +654,7 @@ module Operators = /// Gets the number of elements in the foldable. /// Foldable /// - /// The input foldable. + /// The input foldable. /// The length of the foldable. let inline length (source: '``Foldable<'T>``) : int = Length.Invoke source @@ -1242,6 +1242,7 @@ module Operators = /// /// This is a stable sort, that is the original order of equal elements is preserved. /// + /// A function to transform items of the input collection into comparable keys. /// The input collection. /// /// The result collection. From 555f83a0ce49d7b462bbe91553b7689d0c86440b Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 08:31:29 +0100 Subject: [PATCH 14/15] fix NonEmptySet --- src/FSharpPlus/Data/NonEmptySet.fs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/FSharpPlus/Data/NonEmptySet.fs b/src/FSharpPlus/Data/NonEmptySet.fs index e888f23b0..0bce60fec 100644 --- a/src/FSharpPlus/Data/NonEmptySet.fs +++ b/src/FSharpPlus/Data/NonEmptySet.fs @@ -95,10 +95,10 @@ module NonEmptySet = | x::xs -> create x xs /// Builds a non empty set from the given non-empty sequence. - /// The input sequence. + /// The input sequence. /// Non empty set containing the elements of the non-empty sequence. - let ofNonEmptySeq (seq: _ NonEmptySeq) = - create seq.First (Seq.tail seq) + let ofNonEmptySeq (source: _ NonEmptySeq) = + create source.First (Seq.tail source) /// Builds a non empty set from the given set. /// The input set. @@ -120,15 +120,15 @@ module NonEmptySet = /// Returns a new set with an element added to the set. No exception is raised if /// the set already contains the given element. /// The value to add. - /// The input set. + /// The input set. /// A new set containing value. - let add value (nes: _ NonEmptySet) = { Value = Set.add value nes.Value } + let add value (source: _ NonEmptySet) = { Value = Set.add value source.Value } /// Evaluates to "true" if the given element is in the given set. /// The element to test. - /// The input set. + /// The input set. /// True if element is in set. - let contains element (nes: _ NonEmptySet) = nes.Value |> Set.contains element + let contains element (source: _ NonEmptySet) = source.Value |> Set.contains element /// Evaluates to "true" if all elements of the first set are in the second /// The potential subset. From 967df31b8262b7fa71b1045bb23dba80364d6e50 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 21 Feb 2021 08:32:42 +0100 Subject: [PATCH 15/15] fix NonEmptyMap --- src/FSharpPlus/Data/NonEmptyMap.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FSharpPlus/Data/NonEmptyMap.fs b/src/FSharpPlus/Data/NonEmptyMap.fs index a5eaa67fc..bc08c9462 100644 --- a/src/FSharpPlus/Data/NonEmptyMap.fs +++ b/src/FSharpPlus/Data/NonEmptyMap.fs @@ -107,9 +107,9 @@ module NonEmptyMap = | x::xs -> create x xs /// Builds a non empty map from the given non-empty sequence. - /// The input sequence. + /// The input sequence. /// Non empty map containing the elements of the non-empty sequence. - let ofNonEmptySeq (seq: _ NonEmptySeq) = create seq.First (Seq.tail seq) + let ofNonEmptySeq (source: _ NonEmptySeq) = create source.First (Seq.tail source) /// Builds a non empty map from the given map. /// The input map.