Skip to content

Commit fd9460f

Browse files
authored
About Option doc (#273)
* XML doc for Option.sequenceResult * doc for Option.traverseResult and Option.sequenceResult moved under Option * minor doc changes to get the code referenced by the traverseResult tutorial working
1 parent d1ca343 commit fd9460f

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

gitbook/SUMMARY.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
* [map](option/map.md)
3737
* [map2](option/map2.md)
3838
* [map3](option/map3.md)
39+
* [sequenceResult](option/sequenceResult.md)
3940
* [tee Functions](option/teeFunctions.md)
41+
* [traverseResult](option/traverseResult.md)
4042
* [zip](option/zip.md)
4143
* Lists
4244
* [traverseOptionM](option/traverseOptionM.md)
@@ -62,9 +64,6 @@
6264
* [Operators](resultOption/operators.md)
6365
* [zip](resultOption/zip.md)
6466
* [zipError](resultOption/zipError.md)
65-
* Lists
66-
* [traverseResult](resultOption/traverseResult.md)
67-
* [sequenceResult](resultOption/sequenceResult.md)
6867
* Transforms
6968
* [ofChoice](resultOption/ofChoice.md)
7069
* [ofOption](resultOption/ofOption.md)

gitbook/result/map2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ And an another function that converts a string to an integer:
2626

2727
```fsharp
2828
// string -> Result<int, string>
29-
let tryParseInt str =
29+
let tryParseInt (str: string) =
3030
match System.Int32.TryParse str with
3131
| true, x -> Ok x
3232
| false, _ ->

gitbook/result/map3.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ And an another function that converts a string to an integer:
2626

2727
```fsharp
2828
// string -> Result<int, string>
29-
let tryParseInt str =
29+
let tryParseInt (str: string) =
3030
match System.Int32.TryParse str with
3131
| true, x -> Ok x
3232
| false, _ ->
@@ -66,7 +66,7 @@ type Tweet = private Tweet of string with
6666
Error "Tweet shouldn't be empty"
6767
elif tweet.Length > 280 then
6868
Error "Tweet shouldn't contain more than 280 characters"
69-
else Ok (Tweet x)
69+
else Ok (Tweet tweet)
7070
```
7171

7272
#### CreatePostRequest

src/FsToolkit.ErrorHandling/Option.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ module Option =
128128
binder v
129129
|> Result.map Some
130130

131+
/// <summary>
132+
/// Flips around the option and result structures of an option that contains a result.
133+
/// </summary>
134+
/// <param name="opt">The option containing a result.</param>
135+
/// <returns>A result containing an option.</returns>
131136
let inline sequenceResult (opt: Result<'ok, 'error> option) : Result<'ok option, 'error> =
132137
traverseResult id opt
133138

0 commit comments

Comments
 (0)