From 5a72c6977ab5a0bf0a4a78adb404d7f4783c51a8 Mon Sep 17 00:00:00 2001 From: Giacomo Cavalieri Date: Tue, 18 Apr 2023 22:03:09 +0200 Subject: Improve documentation's code examples --- src/gleam/list.gleam | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index 17dc7d7..4a6d778 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -1571,8 +1571,8 @@ pub fn each(list: List(a), f: fn(a) -> b) -> Nil { /// Takes a function that returns a `Result`. The function is applied to each list item. /// If the function application on an item returns `Ok(_)`, then `try_each` will go on and apply the /// function to the next item. -/// /// However, if any application returns an `Error(_)`, at that point the function will stop executing. +/// /// In any case the function returns `Nil`, even if it passes through all items or incurs in an /// `Error`. /// @@ -1582,7 +1582,7 @@ pub fn each(list: List(a), f: fn(a) -> b) -> Nil { /// > try_each( /// > over: [1, 2, 3], /// > with: fn(x) { -/// > io.print(int.to_string(x)) // prints "1" "2" "3" as single side effects. +/// > x |> int.to_string |> io.print // prints "1" "2" "3" as single side effects. /// > Ok(Nil) /// > }, /// > ) @@ -1593,7 +1593,7 @@ pub fn each(list: List(a), f: fn(a) -> b) -> Nil { /// > try_each( /// > over: [1, 2, 3], /// > with: fn(x) { -/// > io.print(int.to_string(x)) // prints "1" "2" as single side effects. +/// > x |> int.to_string |> io.print // prints "1" "2" as single side effects. /// > case x { /// > 2 -> Error(Nil) /// > _ -> Ok(Nil) -- cgit v1.2.3