Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Deprecate map2 and product in favor of zip #311

Merged
merged 21 commits into from Jan 25, 2021

Conversation

danimontoya
Copy link
Contributor

@danimontoya danimontoya commented Jan 21, 2021

Fixes https://app.clickup.com/t/cf2n35

Discussed here:

In Arrow we have following signatures for all data-types that implement Apply:

fun <A, B, C> Kind<F, A>.map2(fb: Kind<F, B>, f: (A, B) -> C): Kind<F, C>
fun <A, B> Kind<F, A>.product(fb: Kind<F, B>): Kind<F, Tuple2<A, B>>

these should be deprecated towards new implementations which are the functions names from Kotlin Std

fun <A, B, C> Kind<F, A>.zip(fb: Kind<F, B>, f: (A, B) -> C): Kind<F, C>
fun <A, B> Kind<F, A>.zip(fb: Kind<F, B>): Kind<F, Pair<A, B>>

arrow-core-data/src/main/kotlin/arrow/core/Either.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Either.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Either.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Iterable.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Iterable.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Iterable.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Validated.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Validated.kt Outdated Show resolved Hide resolved
# Conflicts:
#	arrow-core-data/src/main/kotlin/arrow/core/Either.kt
#	arrow-core/src/main/kotlin/arrow/core/extensions/list/apply/ListKApply.kt
#	arrow-core/src/main/kotlin/arrow/core/extensions/list/semigroupal/ListKSemigroupal.kt
@danimontoya danimontoya marked this pull request as ready for review January 22, 2021 17:31
Copy link
Member

@nomisRev nomisRev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update deprecation message for map2 & product in EitherApply.kt is missing and then it LGTM.
Eval, Ior and NonEmptyList don't have map2, but we probably also need to define zip for them.
This may be added ehre or can be added in PRs for deprecating Eval, Ior and NonEmptyList.

arrow-core-data/src/main/kotlin/arrow/core/Either.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Either.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Option.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Option.kt Outdated Show resolved Hide resolved
arrow-core-data/src/main/kotlin/arrow/core/Option.kt Outdated Show resolved Hide resolved
It's better to derive it the other way around for performance reasons

Co-authored-by: Simon Vergauwen <nomisRev@users.noreply.github.com>
@nomisRev
Copy link
Member

Thanks @danimontoya! Great work 👏 👏 👏

@danimontoya danimontoya merged commit 0cc9ba9 into master Jan 25, 2021
@danimontoya danimontoya deleted the dm-deprecate-map2-to-zip branch January 25, 2021 16:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants