-
Notifications
You must be signed in to change notification settings - Fork 449
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
Remove Monoid
and Semigroup
combine from replacements
#3003
Conversation
Sorry if this was not clear from the original PR, but we decided against taking that route. The reason is that we break binary compatibility. The breaking change of actually making |
@@ -904,7 +904,7 @@ public sealed class Either<out A, out B> { | |||
|
|||
@Deprecated( | |||
NicheAPI + "Prefer when or fold instead", | |||
ReplaceWith(" fold({ MN.empty() }, f)") | |||
ReplaceWith(" fold({ empty }, f)") |
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 am a bit confused by these replacements. This won't result in correct code, right?
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.
Yes, it won't work. I'm writing an entry in the arrow web migration guide just to explain this. It's the only way to get rid of the Monoid.empty
deprecated method.
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.
Looking forward to seeing how the migration guide looks like :)
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.
Regarding the Monoid empty
value, I see we name it differently in some ReplaceWith
expressions, like empty
, initial
, or initialValue
. We could choose a unique identifier and use it in all the examples for consistency.
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Option.kt
Outdated
Show resolved
Hide resolved
Absolutely, @franciscodr . I've mixed some names from |
Yeah, makes sense to me |
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.
Thanks, @gutiory!
This PR replace any method that belongs to deprecated
Monoid
orSemigroup
that are in the deprecation replacements.The last commit just deprecates thefoldMap
method inFold
interface. I'd need extra 👀 on this, because a bunch of other interfaces implement this interface. Basically, I've done the following:Deprecated thefoldMap
implementation that has aMonoid
parameterRemove thefoldMap
implementation that does not have theMonoid
, but that creates one and used the deprecatedfoldMap
. This makes this method abstract.Every interface that usesFold
implements now the abstractfoldMap
.