From aca9ad92f8ec761d2fdad5b6ccbf900931eddf74 Mon Sep 17 00:00:00 2001 From: Michael Bull Date: Fri, 8 Mar 2024 23:11:16 +0000 Subject: [PATCH] Deprecate get{All,AllErrors} in favour of filter{Values,Errors} --- .../kotlin/com/github/michaelbull/result/Iterable.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kotlin-result/src/commonMain/kotlin/com/github/michaelbull/result/Iterable.kt b/kotlin-result/src/commonMain/kotlin/com/github/michaelbull/result/Iterable.kt index ad484b3..c68d950 100644 --- a/kotlin-result/src/commonMain/kotlin/com/github/michaelbull/result/Iterable.kt +++ b/kotlin-result/src/commonMain/kotlin/com/github/michaelbull/result/Iterable.kt @@ -169,8 +169,12 @@ public fun > getAll(vararg results: R): List { * * - Haskell: [Data.Either.lefts](https://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Either.html#v:lefts) */ +@Deprecated( + message = "Use filterValues instead", + replaceWith = ReplaceWith("filterValues()") +) public fun Iterable>.getAll(): List { - return filterIsInstance>().map { it.value } + return filterValues() } /** @@ -189,8 +193,12 @@ public fun > getAllErrors(vararg results: R): List { * * - Haskell: [Data.Either.rights](https://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Either.html#v:rights) */ +@Deprecated( + message = "Use filterErrors instead", + replaceWith = ReplaceWith("filterErrors()") +) public fun Iterable>.getAllErrors(): List { - return filterIsInstance>().map { it.error } + return filterErrors() } /**