Skip to content

Commit de700aa

Browse files
authored
Fix wrong parameters in XML comments (#427)
1 parent 47b9f54 commit de700aa

File tree

14 files changed

+103
-80
lines changed

14 files changed

+103
-80
lines changed

src/FSharpPlus/Data/NonEmptyList.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ module NonEmptyList =
108108
/// <summary>
109109
/// Zip safely two lists. If one list is shorter, excess elements are discarded from the right end of the longer list.
110110
/// </summary>
111-
/// <param name="a1">First input list.</param>
112-
/// <param name="a2">Second input list.</param>
111+
/// <param name="list1">First input list.</param>
112+
/// <param name="list2">Second input list.</param>
113113
/// <returns>List with corresponding pairs of input lists.</returns>
114114
let zipShortest (list1: NonEmptyList<'T>) (list2: NonEmptyList<'U>) =
115115
{ Head = (list1.Head, list2.Head); Tail = List.zipShortest list1.Tail list2.Tail }

src/FSharpPlus/Data/NonEmptyMap.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ module NonEmptyMap =
107107
| x::xs -> create x xs
108108

109109
/// <summary>Builds a non empty map from the given non-empty sequence.</summary>
110-
/// <param name="sequence">The input sequence.</param>
110+
/// <param name="source">The input sequence.</param>
111111
/// <returns>Non empty map containing the elements of the non-empty sequence.</returns>
112-
let ofNonEmptySeq (seq: _ NonEmptySeq) = create seq.First (Seq.tail seq)
112+
let ofNonEmptySeq (source: _ NonEmptySeq) = create source.First (Seq.tail source)
113113

114114
/// <summary>Builds a non empty map from the given map.</summary>
115115
/// <param name="map">The input map.</param>

src/FSharpPlus/Data/NonEmptySeq.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ module NonEmptySeq =
287287
else Some (unsafeOfArray array)
288288

289289
/// <summary>Builds a non empty sequence from the given list.</summary>
290-
/// <param name="seq">The input list.</param>
290+
/// <param name="list">The input list.</param>
291291
/// <returns>Non empty sequence containing the elements of the list.</returns>
292292
/// <exception cref="System.ArgumentException">Thrown when the input list is empty.</exception>
293293
/// <remarks>Throws exception for empty list</remarks>
@@ -391,7 +391,7 @@ module NonEmptySeq =
391391
///
392392
/// This is a stable sort, that is the original order of equal elements is preserved.</remarks>
393393
/// <param name="comparer">The function to compare the collection elements.</param>
394-
/// <param name="list">The input sequence.</param>
394+
/// <param name="source">The input sequence.</param>
395395
/// <returns>The result sequence.</returns>
396396
/// <remarks>This function consumes the whole input sequence before yielding the first element of the result sequence.</remarks>
397397
let sortWith comparer (source: NonEmptySeq<_>) = Seq.sortWith comparer source |> unsafeOfSeq
@@ -528,4 +528,4 @@ module NonEmptySeqBuilder =
528528
member __.Yield x = NonEmptySeq.singleton x
529529
member __.Delay expr = expr () : NonEmptySeq<'T>
530530

531-
let neseq = NESeqBuilder ()
531+
let neseq = NESeqBuilder ()

src/FSharpPlus/Data/NonEmptySet.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ module NonEmptySet =
9595
| x::xs -> create x xs
9696

9797
/// <summary>Builds a non empty set from the given non-empty sequence.</summary>
98-
/// <param name="list">The input sequence.</param>
98+
/// <param name="source">The input sequence.</param>
9999
/// <returns>Non empty set containing the elements of the non-empty sequence.</returns>
100-
let ofNonEmptySeq (seq: _ NonEmptySeq) =
101-
create seq.First (Seq.tail seq)
100+
let ofNonEmptySeq (source: _ NonEmptySeq) =
101+
create source.First (Seq.tail source)
102102

103103
/// <summary>Builds a non empty set from the given set.</summary>
104104
/// <param name="set">The input set.</param>
@@ -120,15 +120,15 @@ module NonEmptySet =
120120
/// <summary>Returns a new set with an element added to the set. No exception is raised if
121121
/// the set already contains the given element.</summary>
122122
/// <param name="value">The value to add.</param>
123-
/// <param name="set">The input set.</param>
123+
/// <param name="source">The input set.</param>
124124
/// <returns>A new set containing <c>value</c>.</returns>
125-
let add value (nes: _ NonEmptySet) = { Value = Set.add value nes.Value }
125+
let add value (source: _ NonEmptySet) = { Value = Set.add value source.Value }
126126

127127
/// <summary>Evaluates to "true" if the given element is in the given set.</summary>
128128
/// <param name="element">The element to test.</param>
129-
/// <param name="set">The input set.</param>
129+
/// <param name="source">The input set.</param>
130130
/// <returns>True if <c>element</c> is in <c>set</c>.</returns>
131-
let contains element (nes: _ NonEmptySet) = nes.Value |> Set.contains element
131+
let contains element (source: _ NonEmptySet) = source.Value |> Set.contains element
132132

133133
/// <summary>Evaluates to "true" if all elements of the first set are in the second</summary>
134134
/// <param name="set1">The potential subset.</param>

src/FSharpPlus/Extensions/Array.fs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ module Array =
2828

2929

3030
/// <summary>Combines all values from three arrays and calls a mapping function on this combination.</summary>
31-
/// <param name="f">Mapping function taking three element combination as input.</param>
32-
/// <param name="x1">First array.</param>
33-
/// <param name="x2">Second array.</param>
34-
/// <param name="x3">Third array.</param>
31+
/// <param name="mapping">Mapping function taking three element combination as input.</param>
32+
/// <param name="list1">First array.</param>
33+
/// <param name="list2">Second array.</param>
34+
/// <param name="list3">Third array.</param>
3535
///
3636
/// <returns>Array with values returned from mapping function.</returns>
37-
let lift3 f x y z =
38-
let lenx, leny, lenz = Array.length x, Array.length y, Array.length z
39-
let combinedFirstTwo = Array.init (lenx * leny) (fun i -> (x.[i / leny], y.[i % leny]))
37+
let lift3 mapping list1 list2 list3 =
38+
let lenx, leny, lenz = Array.length list1, Array.length list2, Array.length list3
39+
let combinedFirstTwo = Array.init (lenx * leny) (fun i -> (list1.[i / leny], list2.[i % leny]))
4040

41-
Array.init (lenx * leny * lenz) (fun i -> combinedFirstTwo.[i/leny], z.[i%leny])
42-
|> Array.map (fun x -> f (fst (fst x)) (snd (fst x)) (snd x))
41+
Array.init (lenx * leny * lenz) (fun i -> combinedFirstTwo.[i/leny], list3.[i%leny])
42+
|> Array.map (fun x -> mapping (fst (fst x)) (snd (fst x)) (snd x))
4343

4444
/// Concatenates all elements, using the specified separator between each element.
4545
let intercalate (separator: _ []) (source: seq<_ []>) = source |> Seq.intercalate separator |> Seq.toArray
@@ -118,13 +118,13 @@ module Array =
118118
Array.init (min a1.Length a2.Length) (fun i -> a1.[i], a2.[i])
119119

120120
/// <summary>Same as choose but with access to the index.</summary>
121-
/// <param name="f">The mapping function, taking index and element as parameters.</param>
122-
/// <param name="x">The input array.</param>
121+
/// <param name="mapping">The mapping function, taking index and element as parameters.</param>
122+
/// <param name="source">The input array.</param>
123123
///
124124
/// <returns>Array with values x for each Array value where the function returns Some(x).</returns>
125-
let choosei f a =
125+
let choosei mapping source =
126126
let mutable i = ref -1
127127
let fi x =
128128
incr i
129-
f !i x
130-
Array.choose fi a
129+
mapping !i x
130+
Array.choose fi source

src/FSharpPlus/Extensions/Choice.fs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,27 @@ module Choice =
2424
let map (mapping: 'T->'U) (source: Choice<'T,'T2>) = match source with Choice1Of2 v -> Choice1Of2 (mapping v) | Choice2Of2 e -> Choice2Of2 e
2525

2626
/// <summary>Creates a Choice value from a pair of Choice values, using a function to combine the Choice1Of2 values.</summary>
27+
/// <param name="mapping">A function to apply to the Choice1Of2 values.</param>
2728
/// <param name="x">The first Choice value.</param>
2829
/// <param name="y">The second Choice value.</param>
2930
///
3031
/// <returns>The combined value, or the first Choice2Of2.</returns>
31-
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
32+
let map2 mapping (x: Choice<'T,'Error>) (y: Choice<'U,'Error>) : Choice<'V,'Error> =
33+
match x, y with
34+
| Choice1Of2 a, Choice1Of2 b -> Choice1Of2 (mapping a b)
35+
| Choice2Of2 e, _
36+
| _, Choice2Of2 e -> Choice2Of2 e
3237

3338
/// <summary>Creates a Choice value from three of Choice values, using a function to combine the Choice1Of2 values.</summary>
39+
/// <param name="mapping">A function to apply to the Choice1Of2 values.</param>
3440
/// <param name="x">The first Choice value.</param>
3541
/// <param name="y">The second Choice value.</param>
3642
/// <param name="z">The third Choice value.</param>
3743
///
3844
/// <returns>The combined value, or the first Choice2Of2.</returns>
39-
let map3 f (x: Choice<'T,'Error>) (y: Choice<'U,'Error>) (z: Choice<'V, 'Error>) : Choice<'W,'Error> =
45+
let map3 mapping (x: Choice<'T,'Error>) (y: Choice<'U,'Error>) (z: Choice<'V, 'Error>) : Choice<'W,'Error> =
4046
match x, y, z with
41-
| Choice1Of2 a, Choice1Of2 b, Choice1Of2 c -> Choice1Of2 (f a b c)
47+
| Choice1Of2 a, Choice1Of2 b, Choice1Of2 c -> Choice1Of2 (mapping a b c)
4248
| Choice2Of2 e, _ , _
4349
| _ , Choice2Of2 e, _
4450
| _ , _ , Choice2Of2 e -> Choice2Of2 e

src/FSharpPlus/Extensions/Dictionary.fs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,26 @@ module Dictionary =
4949
let values (source: Dictionary<_,_>) = Seq.map (fun (KeyValue(_, v)) -> v) source
5050

5151
/// <summary>Maps the given function over each value in the dictionary.</summary>
52-
/// <param name="f">The mapping function.</param>
52+
/// <param name="mapping">The mapping function.</param>
5353
/// <param name="x">The input dictionary.</param>
5454
///
5555
/// <returns>The mapped dictionary.</returns>
56-
let map f (x: Dictionary<'Key, 'T>) =
56+
let map mapping (x: Dictionary<'Key, 'T>) =
5757
let dct = Dictionary<'Key, 'U> ()
5858
for KeyValue(k, v) in x do
59-
dct.Add (k, f v)
59+
dct.Add (k, mapping v)
6060
dct
6161

6262
/// <summary>Creates a Dictionary value from a pair of Dictionaries, using a function to combine them.</summary>
6363
/// <remarks>Keys that are not present on both dictionaries are dropped.</remarks>
64+
/// <param name="mapping">The mapping function.</param>
6465
/// <param name="x">The first input dictionary.</param>
6566
/// <param name="y">The second input dictionary.</param>
6667
///
6768
/// <returns>The combined dictionary.</returns>
68-
let map2 f (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) =
69+
let map2 mapping (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) =
6970
let dct = Dictionary<'Key, 'U> ()
70-
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f
71+
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt mapping
7172
for KeyValue(k, vx) in x do
7273
match tryGetValue k y with
7374
| Some vy -> dct.Add (k, f.Invoke (vx, vy))
@@ -76,15 +77,15 @@ module Dictionary =
7677

7778
/// <summary>Combines values from three Dictionaries using mapping function.</summary>
7879
/// <remarks>Keys that are not present on every Dictionary are dropped.</remarks>
79-
/// <param name="f">The mapping function.</param>
80+
/// <param name="mapping">The mapping function.</param>
8081
/// <param name="x">First input Dictionary.</param>
8182
/// <param name="y">Second input Dictionary.</param>
82-
/// <param name="y">Third input Dictionary.</param>
83+
/// <param name="z">Third input Dictionary.</param>
8384
///
8485
/// <returns>The mapped Dictionary.</returns>
85-
let map3 f (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) (z: Dictionary<'Key, 'T3>) =
86+
let map3 mapping (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) (z: Dictionary<'Key, 'T3>) =
8687
let dct = Dictionary<'Key, 'U> ()
87-
let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt f
88+
let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt mapping
8889
for KeyValue(k, vx) in x do
8990
match tryGetValue k y, tryGetValue k z with
9091
| Some vy, Some vz -> dct.Add (k, f.Invoke (vx, vy, vz))
@@ -178,4 +179,4 @@ module Dictionary =
178179
match f k v with
179180
| Some v -> dct.Add (k, v)
180181
| None -> ()
181-
dct
182+
dct

src/FSharpPlus/Extensions/Lazy.fs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,31 @@
55
module Lazy =
66

77
/// <summary>Creates a Lazy value from another Lazy value, mapping through a function.</summary>
8+
/// <param name="mapping">The mapping function.</param>
9+
/// <param name="x">The Lazy value.</param>
10+
///
11+
/// <returns>The mappeed value.</returns>
812
let map (mapping: 'T -> 'U) (x: Lazy<'T>) = Lazy<_>.Create (fun () -> mapping x.Value) : Lazy<'U>
913

1014
/// <summary>Creates a Lazy value from a pair of Lazy values, using a mapping function to combine them.</summary>
15+
/// <param name="mapping">The mapping function.</param>
16+
/// <param name="x">The first Lazy value.</param>
17+
/// <param name="y">The second Lazy value.</param>
18+
///
19+
/// <returns>The combined value.</returns>
1120
let map2 (mapping: 'T->'U->'V) (x: Lazy<'T>) (y: Lazy<'U>) = Lazy<_>.Create (fun () -> mapping x.Value y.Value)
1221

1322
/// <summary>Creates a Lazy value from three Lazy values, using a function to combine them.</summary>
23+
/// <param name="mapping">The mapping function.</param>
1424
/// <param name="x">The first Lazy value.</param>
1525
/// <param name="y">The second Lazy value.</param>
1626
/// <param name="z">The third Lazy value.</param>
1727
///
1828
/// <returns>The combined value.</returns>
19-
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)
29+
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)
2030

2131
/// <summary>Applies a Lazy value to a Lazy function.</summary>
2232
/// <param name="f">The Lazy function.</param>
2333
/// <param name="x">The Lazy value.</param>
2434
/// <returns>A Lazy value of the function applied to the value.</returns>
25-
let apply (f: Lazy<'T->'U>) (x: Lazy<'T>) : Lazy<'U> = Lazy<_>.Create (fun () -> f.Value x.Value)
35+
let apply (f: Lazy<'T->'U>) (x: Lazy<'T>) : Lazy<'U> = Lazy<_>.Create (fun () -> f.Value x.Value)

src/FSharpPlus/Extensions/List.fs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ module List =
6464
/// <param name="source">The input list.</param>
6565
///
6666
/// <returns>The result list.</returns>
67-
let drop i list =
67+
let drop count source =
6868
let rec loop i lst =
6969
match lst, i with
7070
| [] as x, _ | x, 0 -> x
7171
| x, n -> loop (n-1) (List.tail x)
72-
if i > 0 then loop i list else list
72+
if count > 0 then loop count source else source
7373

7474
/// Concatenates all elements, using the specified separator between each element.
7575
let intercalate (separator: list<_>) (source: seq<list<_>>) = source |> Seq.intercalate separator |> Seq.toList
@@ -151,26 +151,26 @@ module List =
151151
/// <summary>
152152
/// Zip safely two lists. If one list is shorter, excess elements are discarded from the right end of the longer list.
153153
/// </summary>
154-
/// <param name="a1">First input list.</param>
155-
/// <param name="a2">Second input list.</param>
154+
/// <param name="list1">First input list.</param>
155+
/// <param name="list2">Second input list.</param>
156156
/// <returns>List with corresponding pairs of input lists.</returns>
157-
let zipShortest (l1: list<'T1>) (l2: list<'T2>) =
157+
let zipShortest (list1: list<'T1>) (list2: list<'T2>) =
158158
let rec loop acc = function
159-
| (l::ls,r::rs) -> loop ((l,r)::acc) (ls,rs)
160-
| (_,_) -> acc
161-
loop [] (l1,l2) |> List.rev
159+
| (l::ls, r::rs) -> loop ((l, r)::acc) (ls, rs)
160+
| (_, _) -> acc
161+
loop [] (list1, list2) |> List.rev
162162

163163
/// <summary>Same as choose but with access to the index.</summary>
164-
/// <param name="f">The mapping function, taking index and element as parameters.</param>
165-
/// <param name="x">The input list.</param>
164+
/// <param name="mapping">The mapping function, taking index and element as parameters.</param>
165+
/// <param name="source">The input list.</param>
166166
///
167167
/// <returns>List with values x for each List value where the function returns Some(x).</returns>
168-
let choosei f a =
168+
let choosei mapping source =
169169
let mutable i = ref -1
170170
let fi x =
171171
incr i
172-
f !i x
173-
List.choose fi a
172+
mapping !i x
173+
List.choose fi source
174174

175175
/// <summary>Attempts to remove an item from a list.</summary>
176176
/// <param name="i">The index of the item to remove </param>
@@ -191,4 +191,4 @@ module List =
191191
let setAt i x lst =
192192
if List.length lst > i && i >= 0 then
193193
lst.[0..i-1] @ x::lst.[i+1..]
194-
else lst
194+
else lst

src/FSharpPlus/Extensions/Map.fs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ namespace FSharpPlus
33
/// Additional operations on Map<'Key, 'Value>
44
[<RequireQualifiedAccess>]
55
module Map =
6+
67
open System.Collections.Generic
8+
79
#if !FABLE_COMPILER
810

911
open System.Linq
12+
1013
#endif
1114

1215
/// <summary>Returns the keys of the given map.</summary>
@@ -48,27 +51,27 @@ module Map =
4851

4952
/// <summary>Combines values from three maps using mapping function.</summary>
5053
/// <remarks>Keys that are not present on every Map are dropped.</remarks>
51-
/// <param name="f">The mapping function.</param>
54+
/// <param name="mapping">The mapping function.</param>
5255
/// <param name="x">First input Map.</param>
5356
/// <param name="y">Second input Map.</param>
54-
/// <param name="y">Third input Map.</param>
57+
/// <param name="z">Third input Map.</param>
5558
///
5659
/// <returns>The mapped Map.</returns>
57-
let mapValues3 f (x: Map<'Key, 'T1>) (y: Map<'Key, 'T2>) (z: Map<'Key, 'T3>) = Map <| seq {
58-
let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt f
60+
let mapValues3 mapping (x: Map<'Key, 'T1>) (y: Map<'Key, 'T2>) (z: Map<'Key, 'T3>) = Map <| seq {
61+
let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt mapping
5962
for KeyValue(k, vx) in x do
6063
match Map.tryFind k y, lazy Map.tryFind k z with
6164
| Some vy, Lazy (Some vz) -> yield (k, f.Invoke (vx, vy, vz))
6265
| _ , _ -> () }
6366

6467
/// <summary>Applies given function to each value of the given Map.</summary>
65-
/// <param name="f">The mapping function.</param>
66-
/// <param name="x">The input Map.</param>
68+
/// <param name="mapping">The mapping function.</param>
69+
/// <param name="source">The input Map.</param>
6770
///
6871
/// <returns>Returns Map with values x for each Map value where the function returns Some(x).</returns>
69-
let chooseValues f (x: Map<'Key, 'T>) = Map <| seq {
70-
for KeyValue(k, v) in x do
71-
match f v with
72+
let chooseValues mapping (source: Map<'Key, 'T>) = Map <| seq {
73+
for KeyValue(k, v) in source do
74+
match mapping v with
7275
| Some v -> yield (k, v)
7376
| None -> () }
7477

0 commit comments

Comments
 (0)