-
Notifications
You must be signed in to change notification settings - Fork 450
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
Arrow 2.0 #2778
Conversation
Should we set the minimum version of Kotlin for v2.0, so we know which features we can includes to v2.0. I believe should mostly include stable kotlin features. |
Draft PR for Boxing-free |
@lenguyenthanh that is a great suggestion! We should probably prefer releasing major versions in the future to adopt new language features such as context receivers, or sealed value classes. I suspect development of Arrow 2.0 will take quite some time, so 1.7.x or maybe 1.8.x could be a good candidate. Or should libraries prefer older versions? Is there any documentation oriented for library authors that you know of? |
@kyay10 thanks for taking the time for making the PRs, and doing the investigation 🙏 |
@lenguyenthanh @nomisRev I would suggest targeting the 1.7 series of the compiler, so we can make use of the new context receivers. As you point out, maybe when we release Arrow 2.0 an ever newer version would have come out, so I think that’s a safe bet. |
would it make sense create streamable object like Kotlin flows but with Either or Validated behaviors and operators? (perhaps it's a stupid question) |
I'd like to bring up the possibility of offering a high level class like Scala's ZIO to model an effectful program. What do you think about it? Does it make sense in the context of Arrow? |
Hey @codependent, thanks for the suggestion. Is there any reason or use-cases that you would prefer a I don't think a class like For example the equivalent of ZIO#parZip. object Error
fun one(): Effect<Error, Int> = effect {
delay(100)
1
}
effect<E, A> {
parZip(
{ one().bind() },
{ one().bind() }
) { x, y -> x + y }
}.fold({ fail("Never results in Error") }, { println(it) }) // 2 We can easily nest When Kotlin releases context receivers, you can also drop the |
@nomisRev I was suggesting it since the only aspect that bugged me (just a little bit) is that Arrow offers different monads (Either, Validated, Option...), that usually are present in the return types of the business services, forcing us to convert (transform) them from one to another in our logic definition. ZIO's approach differs in which it aims to provide a One-Monad-For-All and define the program logic just based on it. I misunderstood the introduction of the Effect runtime as way to move to an Arrow "super monad", but as you kindly explained that wasn't necessarily the case. In any case, as you pointed out, context receivers will definitely make our Kotlin code more idiomatic and clearer and Arrow isn't really missing anything feature-wise compared to ZIO. Thanks for your explanation. |
@codependent maybe as a clarification on the StackOverflow answer (and let me know if you think I should update my answer accordingly).
We suspect there are many people in the Kotlin community that would rather work with context(EffectScope<E>)
suspend fun myFunction(): A Given that both are isomorphic to each-other there is no strong technical argument to which is better.
With Arrow 2.0 we want to streamline this more. Reducing the API surface, and optimising for the |
@nomisRev I’ll be glad to have a look at those changes. Apart from those small details, Arrow is a fantastic library that improved noticeably with each version, congrats for the awesome work 👍 |
* Flatten Resource ADT, maintain API
* Shift without suspend, inline all the rest * Add new error handlers signatures * Make ShiftCancellationException private
* Remove all references to shift from new code * Update API files
* Add Resource.allocated() to decompose Resource into it's allocate and… (#2820) * [2743] Migrate internal use of CircuitBreaker double to duration (#2748) * Fix typo (#2824) * Make the server disconnect test more general (#2822) * Update NonEmptyList.fromList deprecation to suggest `toOption()` instead (#2832) * Improve Either.getOrHandle() docs (#2833) * Improve allocated, and fix knit examples Co-authored-by: Jeff Martin <[email protected]> Co-authored-by: Martin Moore <[email protected]> Co-authored-by: valery1707 <[email protected]> Co-authored-by: Lukasz Kalnik <[email protected]> Co-authored-by: stylianosgakis <[email protected]>
* Two small deprecations * Add Atomic module, and StateShift. Implement ior through StateShift * Fix build * Fix atomic knit * Fix knit attempt #2 * Update API files * Remove references to shift
Co-authored-by: Youssef Shoaib <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: serras <[email protected]>
.github/workflows/pull_request.yml
Outdated
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: check | ||
arguments: jvmTest |
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.
Did you experience problems with the build again @serras ?
@@ -50,8 +50,12 @@ class NonEmptyListTest { | |||
|
|||
@Test | |||
fun iterableToNonEmptyListOrNullShouldWorkCorrectlyWhenTheIterableStartsWithOrContainsNull() = runTest { | |||
checkAll(Arb.nonEmptyList(Arb.int().orNull())) { nonEmptyList -> | |||
nonEmptyList.all.toNonEmptyListOrNull().shouldNotBeNull() shouldBe nonEmptyList | |||
checkAll(Arb.list(Arb.int())) { list -> |
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.
This is a PR to track breaking changes to be included in Arrow 2.0.
Proposing new changes
If you would like to propose a feature or change for inclusion in Arrow 2.0, you can either:
arrow-2
branch,One of our goals is to make Arrow simpler to use, so you should expect some amount of discussion for new or breaking APIs.
Breaking changes
Validated
and move methods toEither<NonEmptyList<E>, A>
⇨ Feature/remove validated #2795parTraverseXXX
variants, and addparMapAccumulating
⇨ Introduce parMap and deprecate parTraverseXXX #2863parTraverse
toparMap
⇨ Introduce parMap and deprecate parTraverseXXX #2863Tuple22
toTuple9
Const
andEval
arrow-continuations
CircuitBreaker
andSchedule
into its own package ⇨ PR: Arrow Resilience #2885CircuitBreaker
andSchedule
Effect
based oncatch
⇨ PR: [Arrow 2.0] Effect without suspending shift #2797Nothing
from shift instead of being polymorphic #2810 (comment)test
modules ⇨ PR Removetest
modules #2874 (backported to 1.1.4)NonEmptyList
is now a value class ⇨ PR Implement NonEmptyList using value class #2911Either
andIor
Semigroup
andMonoid
Migration
Exploration
Either#replicate
,Either#find
, etc.Effect<E, A>
atypealias
forsuspend Shift<E>.() -> A
⇨ [Arrow 2.0] Effect without suspending shift #2797Shift
toRaise
(orCanFail
) based on user feedbackrecover
API forOption
&Ior
andcatch
forResult
.PRs closed without merging
Boxing-freeOption
type ⇨ PR: value class impl of Option (called Maybe) prototype #2780Explore the use of context receivers⇨ according to [PROPOSAL] Effect as typealias #2782 (comment) this should not be followed, since context receivers are not supported in Kotlin MultiplatformReview padZip variants when Kotlin zipAll gets into Kotlin Sttd #2483(zipAll
hasn't made it yet to the standard library)