You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/FsToolkit.ErrorHandling/Option.fs
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ module Option =
5
5
6
6
/// <summary>
7
7
/// Binds a function to an option, applying the function to the value if the option is <c>Some</c>.
8
+
///
9
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/bind</href>
8
10
/// </summary>
9
11
/// <param name="mapper">The function to apply to the value.</param>
10
12
/// <param name="input">The input option.</param>
@@ -21,6 +23,8 @@ module Option =
21
23
22
24
/// <summary>
23
25
/// Applies a mapper function to the value inside an option, returning a new option with the mapped value.
26
+
///
27
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/map</href>
24
28
/// </summary>
25
29
/// <param name="mapper">The function to apply to the value inside the option.</param>
26
30
/// <param name="input">The input option.</param>
@@ -35,6 +39,8 @@ module Option =
35
39
36
40
/// <summary>
37
41
/// Applies a mapper function to the values inside two options, returning a new option with the mapped value.
42
+
///
43
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/map2</href>
38
44
/// </summary>
39
45
/// <param name="mapper">The function to apply to the values inside the options.</param>
40
46
/// <param name="input1">The first input option.</param>
@@ -51,6 +57,8 @@ module Option =
51
57
52
58
/// <summary>
53
59
/// Applies a mapper function to the values inside three options, returning a new option with the mapped value.
60
+
///
61
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/map3</href>
54
62
/// </summary>
55
63
/// <param name="mapper">The function to apply to the values inside the options.</param>
56
64
/// <param name="input1">The first input option.</param>
@@ -79,6 +87,8 @@ module Option =
79
87
80
88
/// <summary>
81
89
/// Converts a value option to a regular option.
90
+
///
91
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/transforms/ofvalueoption</href>
82
92
/// </summary>
83
93
/// <param name="vopt">The value option to convert.</param>
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/transforms/tovalueoption</href>
92
104
/// </summary>
93
105
/// <param name="opt">The option value to convert.</param>
94
106
/// <returns>A value option.</returns>
@@ -162,6 +174,8 @@ module Option =
162
174
163
175
/// <summary>
164
176
/// Takes two options and returns a tuple of the pair or <c>None</c> if either are <c>None</c>
177
+
///
178
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/zip</href>
165
179
/// </summary>
166
180
/// <param name="left">The input option</param>
167
181
/// <param name="right">The input option</param>
@@ -173,6 +187,8 @@ module Option =
173
187
174
188
/// <summary>
175
189
/// Converts a <c>Result</c> to an <c>option</c>.
190
+
///
191
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/transforms/ofresult</href>
176
192
/// </summary>
177
193
/// <param name="r">The result to convert.</param>
178
194
/// <returns>An option containing the value if the result is <c>Ok</c>, or <c>None</c> if the result is <c>Error</c></returns>
@@ -187,6 +203,8 @@ module Option =
187
203
/// This is different from <see cref="FSharp.Core.Option.ofObj">Option.ofObj</see> where it doesn't require the value to be constrained to null.
188
204
/// This is beneficial where third party APIs may generate a record type using reflection and it can be null.
189
205
/// See <a href="https://latkin.org/blog/2015/05/18/null-checking-considerations-in-f-its-harder-than-you-think/">Null-checking considerations in F#</a> for more details.
206
+
///
207
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/transforms/ofnull</href>
/// <c>bindNull binder option</c> evaluates to <c>match option with None -> None | Some x -> binder x |> Option.ofNull</c>
203
221
///
204
222
/// Automatically onverts the result of binder that is pontentially null into an option.
223
+
///
224
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/bindnull</href>
205
225
/// </summary>
206
226
/// <param name="binder">A function that takes the value of type 'value from an option and transforms it into
207
227
/// a value of type 'nullableValue.</param>
@@ -222,6 +242,8 @@ module Option =
222
242
223
243
/// <summary>
224
244
/// Returns result of running <paramref name="onSome"/> if it is <c>Some</c>, otherwise returns result of running <paramref name="onNone"/>
245
+
///
246
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/either</href>
225
247
/// </summary>
226
248
/// <param name="onSome">The function to run if <paramref name="input"/> is <c>Some</c></param>
227
249
/// <param name="onNone">The function to run if <paramref name="input"/> is <c>None</c></param>
@@ -240,6 +262,8 @@ module Option =
240
262
241
263
/// <summary>
242
264
/// If the option is <c>Some</c>, executes the function on the <c>Some</c> value and passes through the input value.
265
+
///
266
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/teefunctions#teesome</href>
243
267
/// </summary>
244
268
/// <param name="f">The function to execute on the <c>Some</c> value.</param>
245
269
/// <param name="opt">The input option.</param>
@@ -253,6 +277,8 @@ module Option =
253
277
254
278
/// <summary>
255
279
/// If the option is <c>None</c>, executes the function and passes through the input value.
280
+
///
281
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/teefunctions#teenone</href>
256
282
/// </summary>
257
283
/// <param name="f">The function to execute if the input is <c>None</c>.</param>
258
284
/// <param name="opt">The input option.</param>
@@ -267,6 +293,8 @@ module Option =
267
293
/// <summary>
268
294
/// If the result is <c>Some</c> and the predicate returns true, executes the function
269
295
/// on the <c>Some</c> value and passes through the input value.
296
+
///
297
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/teefunctions#teeif</href>
270
298
/// </summary>
271
299
/// <param name="predicate">The predicate to execute on the <c>Some</c> value.</param>
272
300
/// <param name="f">The function to execute on the <c>Some</c> value if the predicate proves true</param>
@@ -289,6 +317,8 @@ module Option =
289
317
/// Creates an option from a boolean value and a value of type 'a.
290
318
/// If the boolean value is true, returns <c>Some</c> value.
291
319
/// If the boolean value is false, returns <c>None</c>.
320
+
///
321
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/transforms/ofpair</href>
292
322
/// </summary>
293
323
/// <param name="input">A tuple containing a boolean value and a value of type 'a.</param>
0 commit comments