Skip to content

Commit 33376da

Browse files
committed
add warning comment to foldl2.
1 parent 779e902 commit 33376da

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v2.2.1 - 2025-12-16
4+
5+
### Fixed
6+
7+
- Add warning comment to `foldl2`.
8+
- Expose `Foldl2` as a public type.
9+
310
## v2.2.0 - 2024-12-13
411

512
### Added

aiken.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ requirements = []
1313
source = "github"
1414

1515
[etags]
16-
"aiken-lang/fuzz@v2" = [{ secs_since_epoch = 1734106349, nanos_since_epoch = 450591000 }, "64a32283418d58cade34059d3855b857e84505541158c541c460cafa0d355475"]
16+
"aiken-lang/fuzz@v2" = [{ secs_since_epoch = 1765902744, nanos_since_epoch = 267815000 }, "9843473958e51725a9274b487d2d4aac0395ec1a2e30f090724fa737226bc127"]

lib/aiken/collection/list.ak

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,9 +1203,15 @@ pub fn foldl(self: List<a>, zero: b, with: fn(a, b) -> b) -> b {
12031203
}
12041204
}
12051205

1206-
type Fold2<a, b, result> =
1206+
pub type Fold2<a, b, result> =
12071207
fn(a, b) -> result
12081208

1209+
/// > [!CAUTION]
1210+
/// > This function was released by mistake as part of the v2 series of updates. However, unlike the name suggests, it isn't a left-fold but a right-fold.
1211+
/// >
1212+
/// > It cannot be removed without changing its semantic and possibly breaking existing code that relies on it. Sorry for the inconvenience.
1213+
/// >
1214+
/// > Be also aware that starting from `v3.0.0`, this has been fixed. So be careful if you've been using `foldl2` when upgrading to `v3.0.0`; you very likely want to use v3's `foldr2` instead.
12091215
pub fn foldl2(
12101216
self: List<elem>,
12111217
zero_a: a,

0 commit comments

Comments
 (0)