Skip to content

Commit de09432

Browse files
committed
result.then
1 parent 2fbc0b1 commit de09432

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
up picking the same element twice from a given list.
1414
- Improved formatting of JavaScript errors in `string.inspect`.
1515
- JavaScript circular references can now be printed by `string.inspect`.
16+
- The alias `result.then` was deprecated in favour of using `result.try`
17+
directly.
1618

1719
## v0.60.0 - 2025-05-13
1820

src/gleam/result.gleam

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ pub fn try(
165165
}
166166
}
167167

168-
/// An alias for `try`. See the documentation for that function for more information.
169-
///
168+
@deprecated("This function is an alias of result.try, use that instead")
170169
pub fn then(
171170
result: Result(a, e),
172171
apply fun: fn(a) -> Result(b, e),

test/gleam/result_test.gleam

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ pub fn try_test() {
4848
assert result.try(Ok(1), fn(_) { Error(1) }) == Error(1)
4949
}
5050

51-
pub fn then_test() {
52-
assert result.then(Error(1), fn(x) { Ok(x + 1) }) == Error(1)
53-
54-
assert result.then(Ok(1), fn(x) { Ok(x + 1) }) == Ok(2)
55-
56-
assert result.then(Ok(1), fn(_) { Ok("type change") }) == Ok("type change")
57-
58-
assert result.then(Ok(1), fn(_) { Error(1) }) == Error(1)
59-
}
60-
6151
pub fn unwrap_test() {
6252
assert result.unwrap(Ok(1), 50) == 1
6353

0 commit comments

Comments
 (0)