Skip to content

Commit 62b17cd

Browse files
committed
Improve XML docs
1 parent e15be4a commit 62b17cd

File tree

3 files changed

+91
-91
lines changed

3 files changed

+91
-91
lines changed

src/FSharpPlus/Extensions/Dict.fs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,85 +17,85 @@ module Dict =
1717
/// <remarks>This is a function wrapper for the IDictionary.TryGetValue method,
1818
/// representing the result as an Option&lt;value&gt; instead of a bool plus an out-value.
1919
/// </remarks>
20-
/// <param name="k">The key whose value you wish to find.</param>
21-
/// <param name="dct">The input dictionary.</param>
20+
/// <param name="key">The key whose value you wish to find.</param>
21+
/// <param name="source">The input dictionary.</param>
2222
///
2323
/// <returns>An option wrapped value</returns>
24-
let tryGetValue k (dct: IDictionary<'Key, 'Value>) =
25-
match dct.TryGetValue k with
24+
let tryGetValue key (source: IDictionary<'Key, 'Value>) =
25+
match source.TryGetValue key with
2626
| true, v -> Some v
2727
| _ -> None
2828

2929
/// <summary>Does the dictionary contain the given key?</summary>
3030
/// <remarks>Note: this is a function wrapper for the IDictionary.ContainsKey method</remarks>
31-
/// <param name="k">The key to find.</param>
32-
/// <param name="dct">The input dictionary.</param>
31+
/// <param name="key">The key to find.</param>
32+
/// <param name="source">The input dictionary.</param>
3333
///
3434
/// <returns>A bool indicating if the key was found</returns>
35-
let containsKey k (dct: IDictionary<'Key, 'Value>) = dct.ContainsKey k
35+
let containsKey key (source: IDictionary<'Key, 'Value>) = source.ContainsKey key
3636

3737
/// <summary>Returns the keys of the given dictionary.</summary>
3838
/// <param name="source">The input dictionary.</param>
3939
///
4040
/// <returns>A seq of the keys in the dictionary.</returns>
41-
let keys (source: IDictionary<_,_>) = Seq.map (fun (KeyValue(k, _)) -> k) source
41+
let keys (source: IDictionary<_, _>) = Seq.map (fun (KeyValue(k, _)) -> k) source
4242

4343
/// <summary>Returns the values of the given dictionary.</summary>
4444
/// <param name="source">The input dictionary.</param>
4545
///
4646
/// <returns>A seq of the values in the dictionary.</returns>
47-
let values (source: IDictionary<_,_>) = Seq.map (fun (KeyValue(_, v)) -> v) source
47+
let values (source: IDictionary<_, _>) = Seq.map (fun (KeyValue(_, v)) -> v) source
4848

4949
/// <summary>Maps the given function over each value in the dictionary.</summary>
50-
/// <param name="f">The mapping function.</param>
51-
/// <param name="x">The input dictionary.</param>
50+
/// <param name="mapper">The mapping function.</param>
51+
/// <param name="source">The input dictionary.</param>
5252
///
5353
/// <returns>The mapped dictionary.</returns>
54-
let map f (x: IDictionary<'Key, 'T>) =
54+
let map mapper (source: IDictionary<'Key, 'T>) =
5555
let dct = Dictionary<'Key, 'U> ()
56-
for KeyValue(k, v) in x do
57-
dct.Add (k, f v)
56+
for KeyValue(k, v) in source do
57+
dct.Add (k, mapper v)
5858
dct :> IDictionary<'Key, 'U>
5959

6060
/// <summary>Creates a Dictionary value from a pair of Dictionaries, using a function to combine them.</summary>
6161
/// <remarks>Keys that are not present on both dictionaries are dropped.</remarks>
62-
/// <param name="f">The mapping function.</param>
63-
/// <param name="x">The first input dictionary.</param>
64-
/// <param name="y">The second input dictionary.</param>
62+
/// <param name="mapper">The mapping function.</param>
63+
/// <param name="source1">The first input dictionary.</param>
64+
/// <param name="source2">The second input dictionary.</param>
6565
///
6666
/// <returns>The combined dictionary.</returns>
67-
let map2 f (x: IDictionary<'Key, 'T1>) (y: IDictionary<'Key, 'T2>) =
67+
let map2 mapper (source1: IDictionary<'Key, 'T1>) (source2: IDictionary<'Key, 'T2>) =
6868
let dct = Dictionary<'Key, 'U> ()
69-
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f
70-
for KeyValue(k, vx) in x do
71-
match tryGetValue k y with
69+
let f = OptimizedClosures.FSharpFunc<_, _, _>.Adapt mapper
70+
for KeyValue(k, vx) in source1 do
71+
match tryGetValue k source2 with
7272
| Some vy -> dct.Add (k, f.Invoke (vx, vy))
7373
| None -> ()
7474
dct :> IDictionary<'Key, 'U>
7575

7676
/// <summary>Applies given function to each value of the given dictionary.</summary>
77-
/// <param name="f">The mapping function.</param>
78-
/// <param name="x">The input dictionary.</param>
77+
/// <param name="chooser">The mapping function.</param>
78+
/// <param name="source">The input dictionary.</param>
7979
///
8080
/// <returns>Returns dictionary with values x for each dictionary value where the function returns Some(x).</returns>
81-
let chooseValues f (x: IDictionary<'Key, 'T>) =
81+
let chooseValues chooser (source: IDictionary<'Key, 'T>) =
8282
let dct = Dictionary<'Key, 'U> ()
83-
for KeyValue(k, v) in x do
84-
match f v with
83+
for KeyValue(k, v) in source do
84+
match chooser v with
8585
| Some v -> dct.Add (k, v)
8686
| None -> ()
8787
dct :> IDictionary<'Key, 'U>
8888

8989
/// <summary>Tuples values of two dictionaries.</summary>
9090
/// <remarks>Keys that are not present on both dictionaries are dropped.</remarks>
91-
/// <param name="x">The first input dictionary.</param>
92-
/// <param name="y">The second input dictionary.</param>
91+
/// <param name="source1">The first input dictionary.</param>
92+
/// <param name="source2">The second input dictionary.</param>
9393
///
9494
/// <returns>The tupled dictionary.</returns>
95-
let zip (x: IDictionary<'Key, 'T1>) (y: IDictionary<'Key, 'T2>) =
95+
let zip (source1: IDictionary<'Key, 'T1>) (source2: IDictionary<'Key, 'T2>) =
9696
let dct = Dictionary<'Key, 'T1 * 'T2> ()
97-
for KeyValue(k, vx) in x do
98-
match tryGetValue k y with
97+
for KeyValue(k, vx) in source1 do
98+
match tryGetValue k source2 with
9999
| Some vy -> dct.Add (k, (vx, vy))
100100
| None -> ()
101101
dct :> IDictionary<'Key, 'T1 * 'T2>
@@ -133,7 +133,7 @@ module Dict =
133133
.ToDictionary((fun x -> x.Key), (fun y -> y.Value)) :> IDictionary<'Key, 'T>
134134

135135
/// Returns the intersection of two Dicts, using the combiner function for duplicate keys.
136-
let intersectWith combiner (source1:IDictionary<'Key, 'T>) (source2:IDictionary<'Key, 'T>) =
136+
let intersectWith combiner (source1: IDictionary<'Key, 'T>) (source2: IDictionary<'Key, 'T>) =
137137
Enumerable
138138
.Join(
139139
source1,
@@ -145,19 +145,19 @@ module Dict =
145145
.ToDictionary((fun x -> x.Key), (fun y -> y.Value)) :> IDictionary<'Key, 'T>
146146

147147
///Returns the intersection of two Dicts, preferring values from the first in case of duplicate keys.
148-
let intersect (source1:IDictionary<'Key, 'T>) (source2:IDictionary<'Key, 'T>) =
148+
let intersect (source1: IDictionary<'Key, 'T>) (source2: IDictionary<'Key, 'T>) =
149149
intersectWith (fun a _ -> a) source1 source2
150150
#endif
151151

152152
/// <summary>Choose with access to the key.</summary>
153-
/// <param name="f">The mapping function, taking key and element as parameters.</param>
154-
/// <param name="x">The input dictionary.</param>
153+
/// <param name="chooser">The mapping function, taking key and element as parameters.</param>
154+
/// <param name="source">The input dictionary.</param>
155155
///
156156
/// <returns>Dictionary with values (k, x) for each dictionary value where the function returns Some(x).</returns>
157-
let choosei f (x: IDictionary<'Key, 'T>) =
157+
let choosei chooser (source: IDictionary<'Key, 'T>) =
158158
let dct = Dictionary<'Key, 'U> ()
159-
for KeyValue(k, v) in x do
160-
match f k v with
159+
for KeyValue(k, v) in source do
160+
match chooser k v with
161161
| Some v -> dct.Add (k, v)
162162
| None -> ()
163163
dct :> IDictionary<'Key, 'U>

src/FSharpPlus/Extensions/Dictionary.fs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ module Dictionary =
1919
/// which also represents the result as an Option&lt;value&gt; instead of a bool
2020
/// and an out-value.
2121
/// </remarks>
22-
/// <param name="k">The key to find.</param>
23-
/// <param name="dct">The input dictionary.</param>
22+
/// <param name="key">The key to find.</param>
23+
/// <param name="source">The input dictionary.</param>
2424
///
2525
/// <returns>An option wrapped value</returns>
26-
let tryGetValue k (dct: Dictionary<'Key, 'Value>) =
27-
match dct.TryGetValue k with
26+
let tryGetValue key (source: Dictionary<'Key, 'Value>) =
27+
match source.TryGetValue key with
2828
| true, v -> Some v
2929
| _ -> None
3030

3131
/// <summary>Does the dictionary contain the given key?</summary>
3232
/// <remarks>Note: this is a function wrapper for the Dictionary.ContainsKey method.</remarks>
33-
/// <param name="k">The key to find.</param>
34-
/// <param name="dct">The input dictionary.</param>
33+
/// <param name="key">The key to find.</param>
34+
/// <param name="source">The input dictionary.</param>
3535
///
3636
/// <returns>A bool indicating if the key was found</returns>
37-
let containsKey k (dct: Dictionary<'Key, 'Value>) = dct.ContainsKey k
37+
let containsKey key (source: Dictionary<'Key, 'Value>) = source.ContainsKey key
3838

3939
/// <summary>Returns the keys of the given dictionary.</summary>
4040
/// <param name="source">The input dictionary.</param>
@@ -50,71 +50,71 @@ module Dictionary =
5050

5151
/// <summary>Maps the given function over each value in the dictionary.</summary>
5252
/// <param name="mapping">The mapping function.</param>
53-
/// <param name="x">The input dictionary.</param>
53+
/// <param name="source">The input dictionary.</param>
5454
///
5555
/// <returns>The mapped dictionary.</returns>
56-
let map mapping (x: Dictionary<'Key, 'T>) =
56+
let map mapping (source: Dictionary<'Key, 'T>) =
5757
let dct = Dictionary<'Key, 'U> ()
58-
for KeyValue(k, v) in x do
58+
for KeyValue(k, v) in source do
5959
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>
6464
/// <param name="mapping">The mapping function.</param>
65-
/// <param name="x">The first input dictionary.</param>
66-
/// <param name="y">The second input dictionary.</param>
65+
/// <param name="source1">The first input dictionary.</param>
66+
/// <param name="source2">The second input dictionary.</param>
6767
///
6868
/// <returns>The combined dictionary.</returns>
69-
let map2 mapping (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) =
69+
let map2 mapping (source1: Dictionary<'Key, 'T1>) (source2: Dictionary<'Key, 'T2>) =
7070
let dct = Dictionary<'Key, 'U> ()
7171
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt mapping
72-
for KeyValue(k, vx) in x do
73-
match tryGetValue k y with
72+
for KeyValue(k, vx) in source1 do
73+
match tryGetValue k source2 with
7474
| Some vy -> dct.Add (k, f.Invoke (vx, vy))
7575
| None -> ()
7676
dct
7777

7878
/// <summary>Combines values from three Dictionaries using mapping function.</summary>
7979
/// <remarks>Keys that are not present on every Dictionary are dropped.</remarks>
8080
/// <param name="mapping">The mapping function.</param>
81-
/// <param name="x">First input Dictionary.</param>
82-
/// <param name="y">Second input Dictionary.</param>
83-
/// <param name="z">Third input Dictionary.</param>
81+
/// <param name="source1">First input Dictionary.</param>
82+
/// <param name="source2">Second input Dictionary.</param>
83+
/// <param name="source3">Third input Dictionary.</param>
8484
///
8585
/// <returns>The mapped Dictionary.</returns>
86-
let map3 mapping (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) (z: Dictionary<'Key, 'T3>) =
86+
let map3 mapping (source1: Dictionary<'Key, 'T1>) (source2: Dictionary<'Key, 'T2>) (source3: Dictionary<'Key, 'T3>) =
8787
let dct = Dictionary<'Key, 'U> ()
8888
let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt mapping
89-
for KeyValue(k, vx) in x do
90-
match tryGetValue k y, tryGetValue k z with
89+
for KeyValue(k, vx) in source1 do
90+
match tryGetValue k source2, tryGetValue k source3 with
9191
| Some vy, Some vz -> dct.Add (k, f.Invoke (vx, vy, vz))
9292
| _ , _ -> ()
9393
dct
9494

9595
/// <summary>Applies given function to each value of the given dictionary.</summary>
96-
/// <param name="f">The mapping function.</param>
97-
/// <param name="x">The input dictionary.</param>
96+
/// <param name="mapper">The mapping function.</param>
97+
/// <param name="source">The input dictionary.</param>
9898
///
9999
/// <returns>Returns dictionary with values x for each dictionary value where the function returns Some(x).</returns>
100-
let chooseValues f (x: IDictionary<'Key, 'T>) =
100+
let chooseValues mapper (source: IDictionary<'Key, 'T>) =
101101
let dct = Dictionary<'Key, 'U> ()
102-
for KeyValue(k, v) in x do
103-
match f v with
102+
for KeyValue(k, v) in source do
103+
match mapper v with
104104
| Some v -> dct.Add (k, v)
105105
| None -> ()
106106
dct
107107

108108
/// <summary>Tuples values of two dictionaries.</summary>
109109
/// <remarks>Keys that are not present on both dictionaries are dropped.</remarks>
110-
/// <param name="x">The first input dictionary.</param>
111-
/// <param name="y">The second input dictionary.</param>
110+
/// <param name="source1">The first input dictionary.</param>
111+
/// <param name="source2">The second input dictionary.</param>
112112
///
113113
/// <returns>The tupled dictionary.</returns>
114-
let zip (x: Dictionary<'Key, 'T1>) (y: Dictionary<'Key, 'T2>) =
114+
let zip (source1: Dictionary<'Key, 'T1>) (source2: Dictionary<'Key, 'T2>) =
115115
let dct = Dictionary<'Key, 'T1 * 'T2> ()
116-
for KeyValue(k, vx) in x do
117-
match tryGetValue k y with
116+
for KeyValue(k, vx) in source1 do
117+
match tryGetValue k source2 with
118118
| Some vy -> dct.Add (k, (vx, vy))
119119
| None -> ()
120120
dct
@@ -169,14 +169,14 @@ module Dictionary =
169169
#endif
170170

171171
/// <summary>Same as chooseValues but with access to the key.</summary>
172-
/// <param name="f">The mapping function, taking key and element as parameters.</param>
173-
/// <param name="x">The input dictionary.</param>
172+
/// <param name="chooser">The mapping function, taking key and element as parameters.</param>
173+
/// <param name="source">The input dictionary.</param>
174174
///
175175
/// <returns>Dictionary with values (k, x) for each dictionary value where the function returns Some(x).</returns>
176-
let choosei f (x: IDictionary<'Key, 'T>) =
176+
let choosei chooser (source: IDictionary<'Key, 'T>) =
177177
let dct = Dictionary<'Key, 'U> ()
178-
for KeyValue(k, v) in x do
179-
match f k v with
178+
for KeyValue(k, v) in source do
179+
match chooser k v with
180180
| Some v -> dct.Add (k, v)
181181
| None -> ()
182182
dct

src/FSharpPlus/Extensions/IReadOnlyDictionary.fs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@ module IReadOnlyDictionary =
1111
open System.Collections.Generic
1212

1313
/// Replaces or sets the item associated with a specified key with the specified value.
14-
let add key value (table: IReadOnlyDictionary<'Key, 'Value>) = table |> Seq.map (|KeyValue|) |> Map |> Map.add key value :> IReadOnlyDictionary<_,_>
14+
let add key value (source: IReadOnlyDictionary<'Key, 'Value>) = source |> Seq.map (|KeyValue|) |> Map |> Map.add key value :> IReadOnlyDictionary<_,_>
1515

1616
/// Removes the given key from the read-only dictionary.
17-
let remove key (table: IReadOnlyDictionary<'Key, 'Value>) = table |> Seq.filter (fun t -> t.Key <> key) |> Seq.map (|KeyValue|) |> Map :> IReadOnlyDictionary<_,_>
17+
let remove key (source: IReadOnlyDictionary<'Key, 'Value>) = source |> Seq.filter (fun t -> t.Key <> key) |> Seq.map (|KeyValue|) |> Map :> IReadOnlyDictionary<_,_>
1818

1919
/// <summary>Tries to get the value of the given key.</summary>
2020
/// <remarks>This is a function wrapper for the IReadOnlyDictionary.TryGetValue method,
2121
/// representing the result as an Option&lt;value&gt; instead of a bool plus an out-value.
2222
/// </remarks>
23-
/// <param name="k">The key whose value you wish to find.</param>
24-
/// <param name="dct">The input IReadOnlyDictionary.</param>
23+
/// <param name="key">The key whose value you wish to find.</param>
24+
/// <param name="source">The input IReadOnlyDictionary.</param>
2525
///
2626
/// <returns>An option wrapped value.</returns>
27-
let tryGetValue k (dct: IReadOnlyDictionary<'Key, 'Value>) =
28-
match dct.TryGetValue k with
27+
let tryGetValue key (source: IReadOnlyDictionary<'Key, 'Value>) =
28+
match source.TryGetValue key with
2929
| true, v -> Some v
3030
| _ -> None
3131

3232
/// <summary>Does the read-only dictionary contain the given key?</summary>
3333
/// <remarks>Note: this is a function wrapper for the IReadOnlyDictionary.ContainsKey method.</remarks>
34-
/// <param name="k">The key to find.</param>
35-
/// <param name="dct">The input IReadOnlyDictionary.</param>
34+
/// <param name="key">The key to find.</param>
35+
/// <param name="source">The input IReadOnlyDictionary.</param>
3636
///
3737
/// <returns>A bool indicating if the key was found.</returns>
38-
let containsKey k (dct: IReadOnlyDictionary<'Key, 'Value>) = dct.ContainsKey k
38+
let containsKey key (source: IReadOnlyDictionary<'Key, 'Value>) = source.ContainsKey key
3939

4040
/// <summary>Returns the keys of the given read-only dictionary.</summary>
4141
/// <param name="source">The input IReadOnlyDictionary.</param>
@@ -66,16 +66,16 @@ module IReadOnlyDictionary =
6666
/// <summary>Creates a read-only dictionary value from a pair of read-only dictionaries,
6767
/// using a function to combine them.</summary>
6868
/// <remarks>Keys that are not present on both read-only dictionaries are dropped.</remarks>
69-
/// <param name="f">The mapping function.</param>
70-
/// <param name="x">The first input IReadOnlyDictionary.</param>
71-
/// <param name="y">The second input IReadOnlyDictionary.</param>
69+
/// <param name="mapper">The mapping function.</param>
70+
/// <param name="source1">The first input IReadOnlyDictionary.</param>
71+
/// <param name="source2">The second input IReadOnlyDictionary.</param>
7272
///
7373
/// <returns>The combined IReadOnlyDictionary.</returns>
74-
let map2 f (x: IReadOnlyDictionary<'Key, 'T1>) (y: IReadOnlyDictionary<'Key, 'T2>) =
74+
let map2 mapper (source1: IReadOnlyDictionary<'Key, 'T1>) (source2: IReadOnlyDictionary<'Key, 'T2>) =
7575
let dct = Dictionary<'Key, 'U> ()
76-
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f
77-
for KeyValue(k, vx) in x do
78-
match tryGetValue k y with
76+
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt mapper
77+
for KeyValue(k, vx) in source1 do
78+
match tryGetValue k source2 with
7979
| Some vy -> dct.Add (k, f.Invoke (vx, vy))
8080
| None -> ()
8181
dct :> IReadOnlyDictionary<'Key, 'U>
@@ -120,7 +120,7 @@ module IReadOnlyDictionary =
120120

121121
/// <summary>Applies a function to each key and value in a read-only dictionary and then returns
122122
/// a read-only dictionary of entries <c>v</c> where the applied function returned <c>Some(v)</c>.
123-
///
123+
///
124124
/// Returns an empty read-only dictionary when the input read-only dictionary is empty or when the applied chooser function
125125
/// returns <c>None</c> for all elements.
126126
/// </summary>

0 commit comments

Comments
 (0)