Skip to content

Commit 003b492

Browse files
authored
Doc updates (#247)
* Documentation updates * Removed unnecessary line breaks in comments
1 parent f6253d9 commit 003b492

File tree

3 files changed

+378
-45
lines changed

3 files changed

+378
-45
lines changed

gitbook/result/others.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ Returns the contained value if Ok, otherwise returns the provided value
7171
'a -> Result<'a, 'b> -> 'a
7272
```
7373

74+
## defaultError
75+
76+
Returns the contained value if Error, otherwise returns the provided value
77+
78+
### Function Signature
79+
80+
```fsharp
81+
'b -> Result<'a, 'b> -> 'b
82+
```
83+
7484
## defaultWith
7585

7686
Returns the contained value if Ok, otherwise evaluates the given function and returns the result.
@@ -92,6 +102,15 @@ Returns the Ok value or runs the specified function over the error value.
92102
('b -> 'a) -> Result<'a, 'b> -> 'a
93103
```
94104

105+
## ignore
106+
107+
Ignores the value of the input result and returns unit instead
108+
109+
### Function Signature
110+
111+
```fsharp
112+
Result<'ok, 'error> -> Result<unit, 'error>
113+
```
95114

96115
## ignoreError
97116

src/FsToolkit.ErrorHandling/Option.fs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module Option =
55

66
/// <summary>
77
/// 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>
810
/// </summary>
911
/// <param name="mapper">The function to apply to the value.</param>
1012
/// <param name="input">The input option.</param>
@@ -21,6 +23,8 @@ module Option =
2123

2224
/// <summary>
2325
/// 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>
2428
/// </summary>
2529
/// <param name="mapper">The function to apply to the value inside the option.</param>
2630
/// <param name="input">The input option.</param>
@@ -35,6 +39,8 @@ module Option =
3539

3640
/// <summary>
3741
/// 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>
3844
/// </summary>
3945
/// <param name="mapper">The function to apply to the values inside the options.</param>
4046
/// <param name="input1">The first input option.</param>
@@ -51,6 +57,8 @@ module Option =
5157

5258
/// <summary>
5359
/// 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>
5462
/// </summary>
5563
/// <param name="mapper">The function to apply to the values inside the options.</param>
5664
/// <param name="input1">The first input option.</param>
@@ -79,6 +87,8 @@ module Option =
7987

8088
/// <summary>
8189
/// 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>
8292
/// </summary>
8393
/// <param name="vopt">The value option to convert.</param>
8494
/// <returns>The converted regular option.</returns>
@@ -89,6 +99,8 @@ module Option =
8999

90100
/// <summary>
91101
/// Converts an option value to a value option.
102+
///
103+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/transforms/tovalueoption</href>
92104
/// </summary>
93105
/// <param name="opt">The option value to convert.</param>
94106
/// <returns>A value option.</returns>
@@ -162,6 +174,8 @@ module Option =
162174

163175
/// <summary>
164176
/// 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>
165179
/// </summary>
166180
/// <param name="left">The input option</param>
167181
/// <param name="right">The input option</param>
@@ -173,6 +187,8 @@ module Option =
173187

174188
/// <summary>
175189
/// 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>
176192
/// </summary>
177193
/// <param name="r">The result to convert.</param>
178194
/// <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 =
187203
/// 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.
188204
/// This is beneficial where third party APIs may generate a record type using reflection and it can be null.
189205
/// 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>
190208
/// </summary>
191209
/// <param name="value">The potentially null value</param>
192210
/// <returns>An option</returns>
@@ -202,6 +220,8 @@ module Option =
202220
/// <c>bindNull binder option</c> evaluates to <c>match option with None -> None | Some x -> binder x |> Option.ofNull</c>
203221
///
204222
/// 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>
205225
/// </summary>
206226
/// <param name="binder">A function that takes the value of type 'value from an option and transforms it into
207227
/// a value of type 'nullableValue.</param>
@@ -222,6 +242,8 @@ module Option =
222242

223243
/// <summary>
224244
/// 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>
225247
/// </summary>
226248
/// <param name="onSome">The function to run if <paramref name="input"/> is <c>Some</c></param>
227249
/// <param name="onNone">The function to run if <paramref name="input"/> is <c>None</c></param>
@@ -240,6 +262,8 @@ module Option =
240262

241263
/// <summary>
242264
/// 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>
243267
/// </summary>
244268
/// <param name="f">The function to execute on the <c>Some</c> value.</param>
245269
/// <param name="opt">The input option.</param>
@@ -253,6 +277,8 @@ module Option =
253277

254278
/// <summary>
255279
/// 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>
256282
/// </summary>
257283
/// <param name="f">The function to execute if the input is <c>None</c>.</param>
258284
/// <param name="opt">The input option.</param>
@@ -267,6 +293,8 @@ module Option =
267293
/// <summary>
268294
/// If the result is <c>Some</c> and the predicate returns true, executes the function
269295
/// 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>
270298
/// </summary>
271299
/// <param name="predicate">The predicate to execute on the <c>Some</c> value.</param>
272300
/// <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 =
289317
/// Creates an option from a boolean value and a value of type 'a.
290318
/// If the boolean value is true, returns <c>Some</c> value.
291319
/// 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>
292322
/// </summary>
293323
/// <param name="input">A tuple containing a boolean value and a value of type 'a.</param>
294324
/// <returns>An option value.</returns>

0 commit comments

Comments
 (0)