diff options
author | Giacomo Cavalieri <giacomo.cavalieri@icloud.com> | 2023-04-18 22:03:09 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-04-21 12:01:36 +0100 |
commit | 5a72c6977ab5a0bf0a4a78adb404d7f4783c51a8 (patch) | |
tree | 90f94ddc620be9d2b32aae610e295b436578a060 | |
parent | 5522dc325f8e589569f43e64bbc4acbc98152ba1 (diff) | |
download | gleam_stdlib-5a72c6977ab5a0bf0a4a78adb404d7f4783c51a8.tar.gz gleam_stdlib-5a72c6977ab5a0bf0a4a78adb404d7f4783c51a8.zip |
Improve documentation's code examples
-rw-r--r-- | src/gleam/list.gleam | 6 |
1 files 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) |