|
| 1 | +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. |
| 2 | + |
| 3 | +namespace Microsoft.FSharp.Core |
| 4 | + |
| 5 | + open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
| 6 | + |
| 7 | + [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
| 8 | + module Result = |
| 9 | + |
| 10 | + /// <summary><c>map f inp</c> evaluates to <c>match inp with Error e -> Error e | Ok x -> Ok (f x)</c>.</summary> |
| 11 | + /// <param name="mapping">A function to apply to the OK result value.</param> |
| 12 | + /// <param name="result">The input option.</param> |
| 13 | + /// <returns>A result of the input value after applying the mapping function, or Error if the input is Error.</returns> |
| 14 | + [<CompiledName("Map")>] |
| 15 | + val map : mapping:('T -> 'U) -> result:Result<'T, 'TError> -> Result<'U, 'TError> |
| 16 | + |
| 17 | + /// <summary><c>map f inp</c> evaluates to <c>match inp with Error x -> Error (f x) | Ok v -> Ok v</c>.</summary> |
| 18 | + /// <param name="mapping">A function to apply to the OK result value.</param> |
| 19 | + /// <param name="result">The input option.</param> |
| 20 | + /// <returns>A result of the input value after applying the mapping function, or Error if the input is Error.</returns> |
| 21 | + [<CompiledName("MapError")>] |
| 22 | + val mapError: mapping:('TError -> 'U) -> result:Result<'T, 'TError> -> Result<'T, 'U> |
| 23 | + |
| 24 | + /// <summary><c>bind f inp</c> evaluates to <c>match inp with Error e -> Error e | Ok x -> f x</c></summary> |
| 25 | + /// <param name="binder">A function that takes the value of type T from a result and transforms it into |
| 26 | + /// a result containing a value of type U.</param> |
| 27 | + /// <param name="result">The input result.</param> |
| 28 | + /// <returns>A result of the output type of the binder.</returns> |
| 29 | + [<CompiledName("Bind")>] |
| 30 | + val bind: binder:('T -> Result<'U, 'TError>) -> result:Result<'T, 'TError> -> Result<'U, 'TError> |
0 commit comments