diff options
author | Joseph T. Lyons <JosephTLyons@gmail.com> | 2024-10-16 20:06:10 -0400 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-10-17 11:07:54 +0200 |
commit | b277e58babd981112bf649f4e7f8a093937cfcbf (patch) | |
tree | 1f54f4078a73a3b303981987e94bac2627f00056 /src | |
parent | f90957916f9799b6dcb33febd6f2af96f8ac545f (diff) | |
download | gleam_stdlib-b277e58babd981112bf649f4e7f8a093937cfcbf.tar.gz gleam_stdlib-b277e58babd981112bf649f4e7f8a093937cfcbf.zip |
Hint at user when to use lazy_or vs try_recover
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/result.gleam | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gleam/result.gleam b/src/gleam/result.gleam index 5924d19..235c347 100644 --- a/src/gleam/result.gleam +++ b/src/gleam/result.gleam @@ -313,6 +313,8 @@ pub fn or(first: Result(a, e), second: Result(a, e)) -> Result(a, e) { /// Returns the first value if it is `Ok`, otherwise evaluates the given function for a fallback value. /// +/// If you need access to the initial error value, use `result.try_recover`. +/// /// ## Examples /// /// ```gleam @@ -454,6 +456,8 @@ pub fn values(results: List(Result(a, e))) -> List(a) { /// This function is useful for chaining together computations that may fail /// and trying to recover from possible errors. /// +/// If you do not need access to the initial error value, use `result.lazy_or`. +/// /// ## Examples /// /// ```gleam |