-
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
rename Sequence sequenceX, traverseX and deprecate Sequence.some #2686
Conversation
@@ -612,15 +612,19 @@ public fun <A, B> Sequence<Validated<A, B>>.separateValidated(): Pair<Sequence<A | |||
return asep to bsep | |||
} | |||
|
|||
@Deprecated("Terminal operators on Sequence are being deprecated. Please use either one of the supported terminal operators of Sequence and opt for supported [traverse] functions") |
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.
What is the replacement that a user would perform in this case? The current message is a bit cryptic. If we know the expression that would replace sequenceeEither
then we can add it to a ReplaceWith
.
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.
here a user could opt to use toList().sequenceEither()
instead, if that sounds good to all, I can add it?
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.
There are several options here:
-
Deprecate and change the signature to
Sequence<Either<E, A>>.sequenceEither(): Either<E, List<A>>
, which doesn't lie about the fact that it's terminal. This would be more optimized thantoList().sequenceEither()
. -
Deprecate and
ReplaceWith
toList().sequenceEither()
.
Now that I think about it, the latter might be problematic since that cannot short-circuit an infinite Sequence
on Either.Left
but deprecating towards a List
in the return type is going to be very difficult without breaking the Kotlin API (the binary can be kept in tact by using HIDDEN).
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Sequence.kt
Outdated
Show resolved
Hide resolved
…quence.kt Co-authored-by: Imran Malic Settuba <46971368+i-walker@users.noreply.github.com>
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.
It looks excellent @i-walker, thanks. Since we are renaming sequenceX
to sequence
, is there a better name for this operation?. I feel in Kotlin this operation may be confusing by name, and you'd think you'd get a Sequence
back instead of traversing over identity.
Since sequence == traverse(::identity) we could introduce |
Rename to either
sequence
ortraverse
:Deprecate: