aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/gleam/iterator.gleam2
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11627a1..1991ba1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,8 @@
- The `update` function of the `dict` module has been deprecated in favour
of `upsert` and `update` will be used with a different signature in future.
- The behaviour of the string trim functions is now consistent across targets.
+- `iterator.yield` now yields values without waiting for the next one to become
+ available.
## v0.38.0 - 2024-05-24
diff --git a/src/gleam/iterator.gleam b/src/gleam/iterator.gleam
index e4d572a..ad655c4 100644
--- a/src/gleam/iterator.gleam
+++ b/src/gleam/iterator.gleam
@@ -1617,5 +1617,5 @@ pub fn each(over iterator: Iterator(a), with f: fn(a) -> b) -> Nil {
/// ```
///
pub fn yield(element: a, next: fn() -> Iterator(a)) -> Iterator(a) {
- Iterator(fn() { Continue(element, next().continuation) })
+ Iterator(fn() { Continue(element, fn() { next().continuation() }) })
}