-
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
Add Arrow Core & Fx syntax for Kotlin's Result type #2478
Conversation
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.
Amazing stuff! Thank you for adding this 😍
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Iterable.kt
Outdated
Show resolved
Hide resolved
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Result.kt
Outdated
Show resolved
Hide resolved
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Result.kt
Outdated
Show resolved
Hide resolved
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Result.kt
Outdated
Show resolved
Hide resolved
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/computations/result.kt
Outdated
Show resolved
Hide resolved
arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/IterableTest.kt
Show resolved
Hide resolved
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/computations/result.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.
Looks great, @nomisRev. I wonder if we should have Result.bind()
inside the either
block too when E
is Throwable
and in the generic block perhaps Result.bind { throwable -> E }
.
arrow-libs/core/arrow-core-test/src/commonMain/kotlin/arrow/core/test/generators/utils.kt
Show resolved
Hide resolved
Sounds great, and this is actually very easy to add. |
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.
👏🏾
h.exceptionOrNull(), | ||
i.exceptionOrNull(), | ||
j.exceptionOrNull(), | ||
)!!.let(::failure) |
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 had a random thought, not blocking of course. I was wondering if it would make it easier to read these zip implementations if we use computations instead of delegate to higher arity 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.
I choose the most effiecient implementation that was still somewhat readablee and short here. Writing this as a nullable { }
will suffer from the same problem. The only way to write this properly is to be fully exhaustive with fold
but that exploses quickly.
@raulraja, to fully supoort this we need multiple receivers. I added the generic variant. |
@@ -182,7 +182,6 @@ public final class arrow/fx/coroutines/ParTraverse { | |||
public static final fun parSequence (Ljava/lang/Iterable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; | |||
public static final fun parSequence (Ljava/lang/Iterable;Lkotlin/coroutines/CoroutineContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; | |||
public static synthetic fun parSequence$default (Ljava/lang/Iterable;Lkotlin/coroutines/CoroutineContext;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; | |||
public static final fun parSequenceEither (Ljava/lang/Iterable;Larrow/typeclasses/Semigroup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; |
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.
These were incorrectly named inside ParTraverseValidated.kt
.. Should we deprecate them for 0.13.3
?
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 @nomisRev!
No description provided.