-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deprecate combineAll in favour of fold #2687
Conversation
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Iterable.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking care of this @i-walker. We should do the same for Sequence
.
…erable.kt Co-authored-by: Simon Vergauwen <nomisRev@users.noreply.github.com>
Agree, I‘ll take of it in this PR |
…cate-combineAll # Conflicts: # arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Iterable.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Option.kt
Outdated
Show resolved
Hide resolved
@@ -1496,7 +1496,11 @@ public fun <A, B> Either<A, B>.combine(SGA: Semigroup<A>, SGB: Semigroup<B>, b: | |||
} | |||
} | |||
|
|||
@Deprecated("use fold instead", ReplaceWith("fold(MA, MB)", "arrow.core.fold")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should instead of adding this new fold method deprecate towards fold(Monoid.either(MA, MB))
?
These overloads seem a bit redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think these overloads are redundant if we already have one instance for Either that we could take as a single argument.
I never use Monoid
if I can avoid it and prefer a method that takes an empty
value and an assoc
function. That method already exists for Iterable, and it's just fold
. In actual use cases in Kotlin, people are not going to provide their own Monoid
or Semigroup
instances to pass them around. These instances we provide are mainly for primitive types, but most use cases have more complex models inside the Iterable. Since users would not bother to construct complicated instances for Monoid
over their model, these functions quickly become useless and need to be rewritten to basic fold
or similar.
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Either.kt
Outdated
Show resolved
Hide resolved
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/map.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @i-walker 🙌
resolves #2682