Implement the Bitraverse interface in the arrow-core-typeclasses package as follows:
interface Bitraverse<F>: Bifoldable<F> {
fun <G, A, B, C, D> Kind<Kind<F<Kind<G, A>>, Kind<G, A>>>.bitraverse(AP: Applicative<G>, f: (A) -> Kind<G, C>, g: (B) -> Kind<G, D>): Kind<G, Kind<Kind<F, C>, D>>>
fun <G, A, B> Kind<Kind<F<Kind<G, A>>, Kind<G, B>>>.bisequence(AP: Applicative<G>): Kind<G, Kind<Kind<F, A>, B>>> =
bitraverse(::identity, ::identity)
...other necessary functions
}
See Bitraverse.scala for reference, and this tweet to see a visual use case.
The only law is Identity:
def <A, V> bitraverseIdentity(fab: Kind<Kind<F, A>, B>, ...) =
fab.bitraverse(::identity, ::identity).equalsUnderTheLaw(fab, EQ)
Steps:
Hi everyone, I am working on this issue, I have some of the points already and I am trying to have my first full implementation ready this week.
Regards
Brilliant! I'd suggest sending a Draft PR as early as possible so you can have some feedback just in case :D
sure, all the feedback I could have is welcome. I will send the PR as soon as I feel a little confident about it.
Guys I have implemented this in https://github.com/arrow-kt/arrow/pull/1487. Please review it and let me know of stuff you miss, errors or improvements.
@maruiz81 @pakoito #1487 got merged.
Is there something else to add or should we close this ticket?
yes, if you don't have any complaint I think we can close it.
Closing!