@@ -16,8 +16,14 @@ namespace Microsoft.FSharp.Core
1616 /// <param name="result">The input result.</param>
1717 ///
1818 /// <returns>A result of the input value after applying the mapping function, or Error if the input is Error.</returns>
19- ///
20- /// <example-tbd></example-tbd>
19+ ///
20+ /// <example>
21+ /// <code lang="fsharp">
22+ /// Ok 1 |> Result.map (fun x -> "perfect") // evaluates to Ok "perfect"
23+ ///
24+ /// Error "message" |> Result.map (fun x -> "perfect") // evaluates to Error "message"
25+ /// </code>
26+ /// </example>
2127 [<CompiledName( " Map" ) >]
2228 val map : mapping :( 'T -> 'U ) -> result : Result < 'T , 'TError > -> Result < 'U , 'TError >
2329
@@ -27,8 +33,14 @@ namespace Microsoft.FSharp.Core
2733 /// <param name="result">The input result.</param>
2834 ///
2935 /// <returns>A result of the error value after applying the mapping function, or Ok if the input is Ok.</returns>
30- ///
31- /// <example-tbd></example-tbd>
36+ ///
37+ /// <example>
38+ /// <code lang="fsharp">
39+ /// Ok 1 |> Result.mapError (fun x -> "bar") // evaluates to Ok 1
40+ ///
41+ /// Error "foo" |> Result.mapError (fun x -> "bar") // evaluates to Error "bar"
42+ /// </code>
43+ /// </example>
3244 [<CompiledName( " MapError" ) >]
3345 val mapError : mapping :( 'TError -> 'U ) -> result : Result < 'T , 'TError > -> Result < 'T , 'U >
3446
@@ -39,7 +51,20 @@ namespace Microsoft.FSharp.Core
3951 /// <param name="result">The input result.</param>
4052 ///
4153 /// <returns>A result of the output type of the binder.</returns>
42- ///
43- /// <example-tbd></example-tbd>
54+ ///
55+ /// <example>
56+ /// <code lang="fsharp">
57+ /// let tryParse (input: string) =
58+ /// match System.Int32.TryParse input with
59+ /// | true, v -> Ok v
60+ /// | false, _ -> Error "couldn't parse"
61+ ///
62+ /// Error "message" |> Result.bind tryParse // evaluates to Error "message"
63+ ///
64+ /// Ok "42" |> Result.bind tryParse // evaluates to Ok 42
65+ ///
66+ /// Ok "Forty-two" |> Result.bind tryParse // evaluates to Error "couldn't parse"
67+ /// </code>
68+ /// </example>
4469 [<CompiledName( " Bind" ) >]
4570 val bind : binder :( 'T -> Result < 'U , 'TError >) -> result : Result < 'T , 'TError > -> Result < 'U , 'TError >
0 commit comments