From b277e58babd981112bf649f4e7f8a093937cfcbf Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Wed, 16 Oct 2024 20:06:10 -0400 Subject: Hint at user when to use lazy_or vs try_recover --- src/gleam/result.gleam | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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 -- cgit v1.2.3