-
Notifications
You must be signed in to change notification settings - Fork 442
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
Fix parameter order in extension functions in arrow-instances-core #793
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.
Maybe not for this PR but we should add sequence
also because people are using traverse(GA, ::identity)
when they just want sequence(GA)
@raulraja sequence is there on Traverse https://github.com/arrow-kt/arrow/blob/master/modules/core/arrow-typeclasses/src/main/kotlin/arrow/typeclasses/Traverse.kt#L23 Or you mean for the instances? |
I mean as extensions to the kinded versions of the actual data types. |
@@ -101,8 +102,8 @@ interface IdFoldableInstance : Foldable<ForId> { | |||
fix().foldRight(lb, f) | |||
} | |||
|
|||
fun <A, G, B> Id<A>.traverse(f: (A) -> Kind<G, B>, GA: Applicative<G>): Kind<G, Id<B>> = GA.run { | |||
f(fix().value).map({ Id(it) }) | |||
fun <A, G, B> Id<A>.traverse(GA: Applicative<G>, f: (A) -> Kind<G, B>): Kind<G, Id<B>> = GA.run { |
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.
IdOf<A>
?
@@ -99,7 +100,7 @@ interface TryFoldableInstance : Foldable<ForTry> { | |||
fix().foldRight(lb, f) | |||
} | |||
|
|||
fun <A, B, G> Try<A>.traverse(f: (A) -> Kind<G, B>, GA: Applicative<G>): Kind<G, Try<B>> = GA.run { | |||
fun <A, B, G> Try<A>.traverse(GA: Applicative<G>, f: (A) -> Kind<G, B>): Kind<G, Try<B>> = GA.run { |
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.
TryOf<A>
?
Codecov Report
@@ Coverage Diff @@
## master #793 +/- ##
===========================================
- Coverage 43.58% 43.5% -0.09%
Complexity 584 584
===========================================
Files 284 284
Lines 7245 7259 +14
Branches 809 804 -5
===========================================
Hits 3158 3158
- Misses 3802 3819 +17
+ Partials 285 282 -3
Continue to review full report at Codecov.
|
…d add sequence to all traversable datatypes (arrow-kt#793) * Fix parameter order in extension functions in arrow-instances-core * Fix stackoverflow * Add sequence to some traversable datatypes * Fix stackoverflow * Add sequence to remaining datatypes with traverse * Add sequence to remaining datatypes with traverse * Fix ank
No description provided.