From 4c0605a1bcf38f65ad01a9c97832ee61b7ce1f7c Mon Sep 17 00:00:00 2001 From: danimontoya Date: Tue, 26 Jan 2021 13:04:38 +0100 Subject: [PATCH 01/24] Remove extension for EndoMonoid --- arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt index 6869edeb9..17c6425f2 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt @@ -3,10 +3,8 @@ package arrow.core.extensions import arrow.core.Endo import arrow.core.compose import arrow.core.identity -import arrow.extension import arrow.typeclasses.Monoid -@extension interface EndoMonoid : Monoid> { override fun empty(): Endo = Endo(::identity) override fun Endo.combine(g: Endo): Endo = Endo(f.compose(g.f)) From a6bc2c11b11ca20647e77a6ad5115dfe01bbba95 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Tue, 26 Jan 2021 13:14:57 +0100 Subject: [PATCH 02/24] Remove extension and higherkind for Eval --- .../src/main/kotlin/arrow/core/Eval.kt | 15 +++++++++++++-- .../src/main/kotlin/arrow/core/extensions/eval.kt | 7 ------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 447cafec3..ba7cfcbc2 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -1,8 +1,19 @@ package arrow.core -import arrow.higherkind import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement +@Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use one of the provided concrete methods instead") +class ForEval private constructor() { + companion object +} +@Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use one of the provided concrete methods instead") +typealias EvalOf = arrow.Kind + +@Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE") +@Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use one of the provided concrete methods instead") +inline fun EvalOf.fix(): Eval = + this as Eval + fun EvalOf.value(): A = this.fix().value() /** @@ -57,7 +68,6 @@ fun EvalOf.value(): A = this.fix().value() * ``` * */ -@higherkind sealed class Eval : EvalOf { companion object { @@ -254,6 +264,7 @@ sealed class Eval : EvalOf { when (this) { is FlatMap -> object : FlatMap() { override fun start(): Eval = (this@Eval).start() + @IgnoreJRERequirement override fun run(s: S): Eval = object : FlatMap() { diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt index 6f661714a..8b0ddbd7e 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt @@ -5,7 +5,6 @@ import arrow.core.Eval import arrow.core.EvalOf import arrow.core.ForEval import arrow.core.extensions.eval.monad.monad -import arrow.extension import arrow.core.fix import arrow.typeclasses.Applicative import arrow.typeclasses.Apply @@ -16,13 +15,11 @@ import arrow.typeclasses.Monad import arrow.typeclasses.MonadSyntax import arrow.typeclasses.MonadFx -@extension interface EvalFunctor : Functor { override fun EvalOf.map(f: (A) -> B): Eval = fix().map(f) } -@extension interface EvalApply : Apply { override fun EvalOf.ap(ff: EvalOf<(A) -> B>): Eval = fix().ap(ff) @@ -31,7 +28,6 @@ interface EvalApply : Apply { fix().map(f) } -@extension interface EvalApplicative : Applicative { override fun EvalOf.ap(ff: EvalOf<(A) -> B>): Eval = fix().ap(ff) @@ -43,7 +39,6 @@ interface EvalApplicative : Applicative { Eval.just(a) } -@extension interface EvalMonad : Monad { override fun EvalOf.ap(ff: EvalOf<(A) -> B>): Eval = fix().ap(ff) @@ -70,7 +65,6 @@ internal object EvalFxMonad : MonadFx { super.monad(c).fix() } -@extension interface EvalComonad : Comonad { override fun EvalOf.coflatMap(f: (EvalOf) -> B): Eval = fix().coflatMap(f) @@ -82,7 +76,6 @@ interface EvalComonad : Comonad { fix().map(f) } -@extension interface EvalBimonad : Bimonad { override fun EvalOf.ap(ff: EvalOf<(A) -> B>): Eval = fix().ap(ff) From a4df05d9f62d9170e37a05b3cf356bfc4ed6982a Mon Sep 17 00:00:00 2001 From: danimontoya Date: Thu, 28 Jan 2021 13:22:31 +0100 Subject: [PATCH 03/24] Deprecate @extension for Endo --- .../src/main/kotlin/arrow/core/Endo.kt | 10 ++++++++ .../arrow/core/extensions/EndoMonoid.kt | 5 ++++ .../core/extensions/endo/monoid/EndoMonoid.kt | 23 ++++++++++--------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt b/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt index 98e4b8121..ae9821364 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt @@ -1,8 +1,18 @@ package arrow.core +import arrow.typeclasses.Monoid + /** * The monoid of endomorphisms under composition. */ data class Endo(val f: (A) -> A) { companion object } + +fun Monoid.Companion.endo(): Monoid> = object : Monoid> { + override fun empty(): Endo = + Endo(::identity) + + override fun Endo.combine(g: Endo): Endo = + Endo(f.compose(g.f)) +} diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt index 17c6425f2..b87e2fc66 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/EndoMonoid.kt @@ -5,6 +5,11 @@ import arrow.core.compose import arrow.core.identity import arrow.typeclasses.Monoid +@Deprecated( + "Typeclass instance have been moved to the companion object of the typeclass.", + ReplaceWith("Monoid.endo()", "arrow.core.endo", "arrow.typeclasses.Monoid"), + DeprecationLevel.WARNING +) interface EndoMonoid : Monoid> { override fun empty(): Endo = Endo(::identity) override fun Endo.combine(g: Endo): Endo = Endo(f.compose(g.f)) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt index 0ae7034aa..bef00619d 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt @@ -27,14 +27,14 @@ internal val monoid_singleton: EndoMonoid = object : EndoMonoid {} @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "combineAll()", - "arrow.core.combineAll" + "if (isEmpty()) empty() else reduce { a, b -> a.combine(b) }" ), DeprecationLevel.WARNING ) -fun Collection>.combineAll(): Endo = arrow.core.Endo.monoid().run { - this@combineAll.combineAll() as arrow.core.Endo -} +fun Collection>.combineAll(): Endo = + arrow.core.Endo.monoid().run { + this@combineAll.combineAll() as arrow.core.Endo + } @JvmName("combineAll") @Suppress( @@ -46,18 +46,19 @@ fun Collection>.combineAll(): Endo = arrow.core.Endo.monoid(). @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "combineAll(arg0)", - "arrow.core.Endo.combineAll" + "if (arg0.isEmpty()) empty() else arg0.reduce { a, b -> a.combine(b) }" ), DeprecationLevel.WARNING ) -fun combineAll(arg0: List>): Endo = arrow.core.Endo - .monoid() - .combineAll(arg0) as arrow.core.Endo +fun combineAll(arg0: List>): Endo = + arrow.core.Endo + .monoid() + .combineAll(arg0) as arrow.core.Endo @Suppress( "UNCHECKED_CAST", "NOTHING_TO_INLINE" ) +@Deprecated("Monoid typeclasses is deprecated. Use concrete methods on Endo") inline fun Companion.monoid(): EndoMonoid = monoid_singleton as - arrow.core.extensions.EndoMonoid + arrow.core.extensions.EndoMonoid From 4234badab1eeb32e733c572fd9d328b14548c7b9 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Thu, 28 Jan 2021 17:45:34 +0100 Subject: [PATCH 04/24] Add combine for Endo and update ReplaceWith --- arrow-core-data/src/main/kotlin/arrow/core/Endo.kt | 3 +++ .../arrow/core/extensions/endo/monoid/EndoMonoid.kt | 13 ++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt b/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt index ae9821364..8ea31fcda 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt @@ -9,6 +9,9 @@ data class Endo(val f: (A) -> A) { companion object } +fun Endo.combine(g: Endo): Endo = + Endo(f.compose(g.f)) + fun Monoid.Companion.endo(): Monoid> = object : Monoid> { override fun empty(): Endo = Endo(::identity) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt index bef00619d..840401ecd 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt @@ -3,13 +3,6 @@ package arrow.core.extensions.endo.monoid import arrow.core.Endo import arrow.core.Endo.Companion import arrow.core.extensions.EndoMonoid -import kotlin.Any -import kotlin.Deprecated -import kotlin.PublishedApi -import kotlin.Suppress -import kotlin.collections.Collection -import kotlin.collections.List -import kotlin.jvm.JvmName /** * cached extension @@ -27,7 +20,8 @@ internal val monoid_singleton: EndoMonoid = object : EndoMonoid {} @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "if (isEmpty()) empty() else reduce { a, b -> a.combine(b) }" + "if (isEmpty()) Endo(::identity) else reduce { a, b -> a.combine(b) }", + "arrow.core.combine" ), DeprecationLevel.WARNING ) @@ -46,7 +40,8 @@ fun Collection>.combineAll(): Endo = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "if (arg0.isEmpty()) empty() else arg0.reduce { a, b -> a.combine(b) }" + "if (arg0.isEmpty()) Endo(::identity) else arg0.reduce { a, b -> a.combine(b) }", + "arrow.core.combine" ), DeprecationLevel.WARNING ) From e2c54a92f016a16a8edee1f586b7abadf5305736 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Thu, 28 Jan 2021 18:32:35 +0100 Subject: [PATCH 05/24] Add mapN for Eval --- .../src/main/kotlin/arrow/core/Eval.kt | 119 ++++++++++++++++++ .../eval/applicative/EvalApplicative.kt | 39 +++--- 2 files changed, 134 insertions(+), 24 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index ba7cfcbc2..66140be63 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -256,6 +256,125 @@ sealed class Eval : EvalOf { inline fun map(crossinline f: (A) -> B): Eval = flatMap { a -> Now(f(a)) } + inline fun mapN( + a: Eval, + b: Eval, + crossinline map: (A, B) -> C + ): Eval = + mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { b, c, _, _, _, _, _, _, _, _ -> map(b, c) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + crossinline map: (A, B, C) -> D + ): Eval = + mapN(a, b, c, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { b, c, d, _, _, _, _, _, _, _ -> map(b, c, d) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + crossinline map: (A, B, C, D) -> E + ): Eval = + mapN(a, b, c, d, Unit, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, _, _, _, _, _, _ -> map(a, b, c, d) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + crossinline map: (A, B, C, D, E) -> F + ): Eval = + mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, e, f, _, _, _, _ -> map(a, b, c, d, e) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + crossinline map: (A, B, C, D, E, F) -> G + ): Eval = + mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { a, b, c, d, e, f, _, _, _, _ -> map(a, b, c, d, e, f) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + crossinline map: (A, B, C, D, E, F, G) -> H + ): Eval = + mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { a, b, c, d, e, f, g, _, _, _ -> map(a, b, c, d, e, f, g) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + crossinline map: (A, B, C, D, E, F, G, H) -> I + ): Eval = + mapN(a, b, c, d, e, f, g, h, Unit, Unit) { a, b, c, d, e, f, g, h, _, _ -> map(a, b, c, d, e, f, g, h) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + i: Eval, + crossinline map: (A, B, C, D, E, F, G, H, I) -> J + ): Eval = + mapN(a, b, c, d, e, f, g, h, i, Unit) { a, b, c, d, e, f, g, h, i, _ -> map(a, b, c, d, e, f, g, h, i) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + i: Eval, + j: Eval, + crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K + ): Eval = + a.flatMap { aa -> + b.flatMap { bb -> + c.flatMap { cc -> + d.flatMap { dd -> + e.flatMap { ee -> + f.flatMap { ff -> + g.flatMap { gg -> + h.flatMap { hh -> + i.flatMap { ii -> + j.map { jj -> + map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) + } + } + } + } + } + } + } + } + } + } + fun ap(ff: EvalOf<(A) -> B>): Eval = ff.fix().flatMap { f -> map(f) }.fix() diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt index 696910f71..8b8d41c36 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt @@ -6,21 +6,12 @@ import arrow.core.Eval.Companion import arrow.core.ForEval import arrow.core.extensions.EvalApplicative import arrow.typeclasses.Monoid -import kotlin.Deprecated -import kotlin.Function1 -import kotlin.Int -import kotlin.PublishedApi -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List -import kotlin.jvm.JvmName /** * cached extension */ @PublishedApi() -internal val applicative_singleton: EvalApplicative = object : arrow.core.extensions.EvalApplicative - {} +internal val applicative_singleton: EvalApplicative = object : arrow.core.extensions.EvalApplicative {} @JvmName("just1") @Suppress( @@ -32,8 +23,8 @@ internal val applicative_singleton: EvalApplicative = object : arrow.core.extens @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "just()", - "arrow.core.just" + "just()", + "arrow.core.just" ), DeprecationLevel.WARNING ) @@ -51,14 +42,14 @@ fun A.just(): Eval = arrow.core.Eval.applicative().run { @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "unit()", - "arrow.core.Eval.unit" + "just(Unit)", + "arrow.core.just" ), DeprecationLevel.WARNING ) fun unit(): Eval = arrow.core.Eval - .applicative() - .unit() as arrow.core.Eval + .applicative() + .unit() as arrow.core.Eval @JvmName("map") @Suppress( @@ -70,15 +61,15 @@ fun unit(): Eval = arrow.core.Eval @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg1)", - "arrow.core.map" + "map(arg1)", + "arrow.core.map" ), DeprecationLevel.WARNING ) fun Kind.map(arg1: Function1): Eval = - arrow.core.Eval.applicative().run { - this@map.map(arg1) as arrow.core.Eval -} + arrow.core.Eval.applicative().run { + this@map.map(arg1) as arrow.core.Eval + } @JvmName("replicate") @Suppress( @@ -115,9 +106,9 @@ fun Kind.replicate(arg1: Int): Eval> = arrow.core.Eval.a DeprecationLevel.WARNING ) fun Kind.replicate(arg1: Int, arg2: Monoid): Eval = - arrow.core.Eval.applicative().run { - this@replicate.replicate(arg1, arg2) as arrow.core.Eval -} + arrow.core.Eval.applicative().run { + this@replicate.replicate(arg1, arg2) as arrow.core.Eval + } @Suppress( "UNCHECKED_CAST", From 2550d470358b409dd4dc3b2683a871748f7d215f Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 09:24:49 +0100 Subject: [PATCH 06/24] Deprecate extension methods of EvalApplicative.kt --- arrow-core-data/src/main/kotlin/arrow/core/Eval.kt | 13 ++++++++++++- .../main/kotlin/arrow/typeclasses/Applicative.kt | 4 ++-- .../extensions/eval/applicative/EvalApplicative.kt | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 66140be63..13ed004ef 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -1,5 +1,7 @@ package arrow.core +import arrow.core.Eval.Companion.just +import arrow.typeclasses.Monoid import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement @Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use one of the provided concrete methods instead") @@ -288,7 +290,7 @@ sealed class Eval : EvalOf { e: Eval, crossinline map: (A, B, C, D, E) -> F ): Eval = - mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, e, f, _, _, _, _ -> map(a, b, c, d, e) } + mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, e, _, _, _, _, _ -> map(a, b, c, d, e) } inline fun mapN( a: Eval, @@ -502,3 +504,12 @@ fun Eval.zip(fb: Eval, f: (A, B) -> Z): Eval = fun Eval.zip(fb: Eval): Eval> = flatMap { a: A -> fb.map { b -> Pair(a, b) } } + +fun Eval.replicate(n: Int): Eval> = + if (n <= 0) just(emptyList()) + else mapN(this, replicate(n - 1)) { a: A, xs: List -> listOf(a) + xs } + +fun Eval.replicate(n: Int, MA: Monoid): Eval = MA.run { + if (n <= 0) just(MA.empty()) + else mapN(this@replicate, replicate(n - 1, MA)) { a: A, xs: A -> MA.run { a + xs } } +} diff --git a/arrow-core-data/src/main/kotlin/arrow/typeclasses/Applicative.kt b/arrow-core-data/src/main/kotlin/arrow/typeclasses/Applicative.kt index 8848f78db..7eaa7d2c9 100644 --- a/arrow-core-data/src/main/kotlin/arrow/typeclasses/Applicative.kt +++ b/arrow-core-data/src/main/kotlin/arrow/typeclasses/Applicative.kt @@ -18,11 +18,11 @@ interface Applicative : Apply { fun Kind.replicate(n: Int): Kind> = if (n <= 0) just(emptyList()) - else mapN(this, replicate(n - 1)) { (a, xs) -> listOf(a) + xs } + else mapN(this, replicate(n - 1)) { (a: A, xs: List) -> listOf(a) + xs } fun Kind.replicate(n: Int, MA: Monoid): Kind = if (n <= 0) just(MA.empty()) - else mapN(this@replicate, replicate(n - 1, MA)) { (a, xs) -> MA.run { a + xs } } + else mapN(this@replicate, replicate(n - 1, MA)) { (a: A, xs: A) -> MA.run { a + xs } } } @Deprecated("Applicative typeclass is deprecated") diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt index 8b8d41c36..400f77d44 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt @@ -114,4 +114,5 @@ fun Kind.replicate(arg1: Int, arg2: Monoid): Eval = "UNCHECKED_CAST", "NOTHING_TO_INLINE" ) +@Deprecated("Applicative typeclass is deprecated. Use concrete methods on Eval") inline fun Companion.applicative(): EvalApplicative = applicative_singleton From dcbd5bf1274035cb6fc4ac2eba05c37244674e72 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 09:32:47 +0100 Subject: [PATCH 07/24] Format and imports --- .../eval/applicative/EvalApplicative.kt | 8 +- .../core/extensions/eval/apply/EvalApply.kt | 503 +++++++++--------- .../extensions/eval/bimonad/EvalBimonad.kt | 2 - .../extensions/eval/comonad/EvalComonad.kt | 37 +- .../extensions/eval/functor/EvalFunctor.kt | 112 ++-- .../core/extensions/eval/monad/EvalMonad.kt | 184 ++++--- 6 files changed, 415 insertions(+), 431 deletions(-) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt index 400f77d44..71e314382 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt @@ -81,8 +81,8 @@ fun Kind.map(arg1: Function1): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "replicate(arg1)", - "arrow.core.replicate" + "replicate(arg1)", + "arrow.core.replicate" ), DeprecationLevel.WARNING ) @@ -100,8 +100,8 @@ fun Kind.replicate(arg1: Int): Eval> = arrow.core.Eval.a @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "replicate(arg1, arg2)", - "arrow.core.replicate" + "replicate(arg1, arg2)", + "arrow.core.replicate" ), DeprecationLevel.WARNING ) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt index ac8c69d61..4b94e7c0f 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt @@ -14,11 +14,6 @@ import arrow.core.Tuple7 import arrow.core.Tuple8 import arrow.core.Tuple9 import arrow.core.extensions.EvalApply -import kotlin.Deprecated -import kotlin.Function1 -import kotlin.PublishedApi -import kotlin.Suppress -import kotlin.jvm.JvmName /** * cached extension @@ -36,15 +31,15 @@ internal val apply_singleton: EvalApply = object : arrow.core.extensions.EvalApp @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "ap(arg1)", - "arrow.core.ap" + "ap(arg1)", + "arrow.core.ap" ), DeprecationLevel.WARNING ) fun Kind.ap(arg1: Kind>): Eval = - arrow.core.Eval.apply().run { - this@ap.ap(arg1) as arrow.core.Eval -} + arrow.core.Eval.apply().run { + this@ap.ap(arg1) as arrow.core.Eval + } @JvmName("apEval") @Suppress( @@ -56,15 +51,15 @@ fun Kind.ap(arg1: Kind>): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "apEval(arg1)", - "arrow.core.apEval" + "apEval(arg1)", + "arrow.core.apEval" ), DeprecationLevel.WARNING ) -fun Kind.apEval(arg1: Eval>>): Eval> = arrow.core.Eval.apply().run { - this@apEval.apEval(arg1) as arrow.core.Eval> -} +fun Kind.apEval(arg1: Eval>>): Eval> = + arrow.core.Eval.apply().run { + this@apEval.apEval(arg1) as arrow.core.Eval> + } @JvmName("map2Eval") @Suppress( @@ -76,8 +71,8 @@ fun Kind.apEval(arg1: Eval>>): @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map2Eval(arg1, arg2)", - "arrow.core.map2Eval" + "map2Eval(arg1, arg2)", + "arrow.core.map2Eval" ), DeprecationLevel.WARNING ) @@ -98,8 +93,8 @@ fun Kind.map2Eval( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -108,8 +103,8 @@ fun map( arg1: Kind, arg2: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2) as arrow.core.Eval + .apply() + .map(arg0, arg1, arg2) as arrow.core.Eval @JvmName("mapN") @Suppress( @@ -121,8 +116,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -131,8 +126,8 @@ fun mapN( arg1: Kind, arg2: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2) as arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2) as arrow.core.Eval @JvmName("map") @Suppress( @@ -144,8 +139,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2, arg3)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -155,8 +150,8 @@ fun map( arg2: Kind, arg3: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2, arg3) as arrow.core.Eval + .apply() + .map(arg0, arg1, arg2, arg3) as arrow.core.Eval @JvmName("mapN") @Suppress( @@ -168,8 +163,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2, arg3)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -179,8 +174,8 @@ fun mapN( arg2: Kind, arg3: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2, arg3) as arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2, arg3) as arrow.core.Eval @JvmName("map") @Suppress( @@ -192,8 +187,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2, arg3, arg4)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -204,8 +199,8 @@ fun map( arg3: Kind, arg4: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2, arg3, arg4) as arrow.core.Eval + .apply() + .map(arg0, arg1, arg2, arg3, arg4) as arrow.core.Eval @JvmName("mapN") @Suppress( @@ -217,8 +212,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2, arg3, arg4)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -229,8 +224,8 @@ fun mapN( arg3: Kind, arg4: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2, arg3, arg4) as arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2, arg3, arg4) as arrow.core.Eval @JvmName("map") @Suppress( @@ -242,8 +237,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2, arg3, arg4, arg5)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -255,8 +250,8 @@ fun map( arg4: Kind, arg5: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2, arg3, arg4, arg5) as arrow.core.Eval + .apply() + .map(arg0, arg1, arg2, arg3, arg4, arg5) as arrow.core.Eval @JvmName("mapN") @Suppress( @@ -268,8 +263,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2, arg3, arg4, arg5)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -281,8 +276,8 @@ fun mapN( arg4: Kind, arg5: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2, arg3, arg4, arg5) as arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2, arg3, arg4, arg5) as arrow.core.Eval @JvmName("map") @Suppress( @@ -294,8 +289,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -308,8 +303,8 @@ fun map( arg5: Kind, arg6: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6) as arrow.core.Eval + .apply() + .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6) as arrow.core.Eval @JvmName("mapN") @Suppress( @@ -321,8 +316,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -335,8 +330,8 @@ fun mapN( arg5: Kind, arg6: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) as arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) as arrow.core.Eval @JvmName("map") @Suppress( @@ -348,8 +343,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -363,9 +358,9 @@ fun map( arg6: Kind, arg7: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) as - arrow.core.Eval + .apply() + .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) as + arrow.core.Eval @JvmName("mapN") @Suppress( @@ -377,8 +372,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -392,9 +387,9 @@ fun mapN( arg6: Kind, arg7: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) as - arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) as + arrow.core.Eval @JvmName("map") @Suppress( @@ -406,8 +401,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -422,9 +417,9 @@ fun map( arg7: Kind, arg8: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) as - arrow.core.Eval + .apply() + .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) as + arrow.core.Eval @JvmName("mapN") @Suppress( @@ -436,8 +431,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -452,9 +447,9 @@ fun mapN( arg7: Kind, arg8: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) as - arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) as + arrow.core.Eval @JvmName("map") @Suppress( @@ -466,8 +461,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -483,9 +478,9 @@ fun map( arg8: Kind, arg9: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) - as arrow.core.Eval + .apply() + .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) + as arrow.core.Eval @JvmName("mapN") @Suppress( @@ -497,8 +492,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -514,9 +509,9 @@ fun mapN( arg8: Kind, arg9: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) - as arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) as + arrow.core.Eval @JvmName("map") @Suppress( @@ -528,8 +523,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", - "arrow.core.Eval.map" + "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", + "arrow.core.Eval.map" ), DeprecationLevel.WARNING ) @@ -546,9 +541,9 @@ fun map( arg9: Kind, arg10: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) as arrow.core.Eval + .apply() + .map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) as + arrow.core.Eval @JvmName("mapN") @Suppress( @@ -560,8 +555,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", - "arrow.core.Eval.mapN" + "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", + "arrow.core.Eval.mapN" ), DeprecationLevel.WARNING ) @@ -578,9 +573,9 @@ fun mapN( arg9: Kind, arg10: Function1, Z> ): Eval = arrow.core.Eval - .apply() - .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) as arrow.core.Eval + .apply() + .mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) as + arrow.core.Eval @JvmName("map2") @Suppress( @@ -592,15 +587,15 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map2(arg1, arg2)", - "arrow.core.map2" + "map2(arg1, arg2)", + "arrow.core.map2" ), DeprecationLevel.WARNING ) -fun Kind.map2(arg1: Kind, arg2: Function1, Z>): - Eval = arrow.core.Eval.apply().run { - this@map2.map2(arg1, arg2) as arrow.core.Eval -} +fun Kind.map2(arg1: Kind, arg2: Function1, Z>): Eval = + arrow.core.Eval.apply().run { + this@map2.map2(arg1, arg2) as arrow.core.Eval + } @JvmName("product") @Suppress( @@ -612,15 +607,15 @@ fun Kind.map2(arg1: Kind, arg2: Function1 Kind.product(arg1: Kind): Eval> = - arrow.core.Eval.apply().run { - this@product.product(arg1) as arrow.core.Eval> -} + arrow.core.Eval.apply().run { + this@product.product(arg1) as arrow.core.Eval> + } @JvmName("product1") @Suppress( @@ -632,15 +627,15 @@ fun Kind.product(arg1: Kind): Eval> @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "product(arg1)", + "arrow.core.product" ), DeprecationLevel.WARNING ) fun Kind>.product(arg1: Kind): Eval> = - arrow.core.Eval.apply().run { - this@product.product(arg1) as arrow.core.Eval> -} + arrow.core.Eval.apply().run { + this@product.product(arg1) as arrow.core.Eval> + } @JvmName("product2") @Suppress( @@ -652,15 +647,15 @@ fun Kind>.product(arg1: Kind): Eval< @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "product(arg1)", + "arrow.core.product" ), DeprecationLevel.WARNING ) -fun Kind>.product(arg1: Kind): Eval> = arrow.core.Eval.apply().run { - this@product.product(arg1) as arrow.core.Eval> -} +fun Kind>.product(arg1: Kind): Eval> = + arrow.core.Eval.apply().run { + this@product.product(arg1) as arrow.core.Eval> + } @JvmName("product3") @Suppress( @@ -672,13 +667,14 @@ fun Kind>.product(arg1: Kind): @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "product(arg1)", + "arrow.core.product" ), DeprecationLevel.WARNING ) -fun Kind>.product(arg1: Kind): - Eval> = arrow.core.Eval.apply().run { +fun Kind>.product( + arg1: Kind +): Eval> = arrow.core.Eval.apply().run { this@product.product(arg1) as arrow.core.Eval> } @@ -692,15 +688,15 @@ fun Kind>.product(arg1: Kind Kind>.product(arg1: Kind): - Eval> = arrow.core.Eval.apply().run { - this@product.product(arg1) as arrow.core.Eval> +fun Kind>.product( + arg1: Kind +): Eval> = arrow.core.Eval.apply().run { + this@product.product(arg1) as arrow.core.Eval> } @JvmName("product5") @@ -713,15 +709,15 @@ fun Kind>.product(arg1: Kind Kind>.product(arg1: Kind): - Eval> = arrow.core.Eval.apply().run { - this@product.product(arg1) as arrow.core.Eval> +fun Kind>.product( + arg1: Kind +): Eval> = arrow.core.Eval.apply().run { + this@product.product(arg1) as arrow.core.Eval> } @JvmName("product6") @@ -734,17 +730,17 @@ fun Kind>.product(arg1 @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "product(arg1)", + "arrow.core.product" ), DeprecationLevel.WARNING ) -fun Kind>.product(arg1: Kind): Eval> = - arrow.core.Eval.apply().run { - this@product.product(arg1) as arrow.core.Eval> -} +fun Kind>.product( + arg1: Kind +): Eval> = + arrow.core.Eval.apply().run { + this@product.product(arg1) as arrow.core.Eval> + } @JvmName("product7") @Suppress( @@ -756,17 +752,17 @@ fun Kind Kind>.product(arg1: Kind): Eval> = - arrow.core.Eval.apply().run { - this@product.product(arg1) as arrow.core.Eval> -} +fun Kind>.product( + arg1: Kind +): Eval> = + arrow.core.Eval.apply().run { + this@product.product(arg1) as arrow.core.Eval> + } @JvmName("product8") @Suppress( @@ -778,17 +774,18 @@ fun Kind Kind>.product(arg1: Kind): Eval> = - arrow.core.Eval.apply().run { - this@product.product(arg1) as arrow.core.Eval> -} +fun Kind>.product( + arg1: Kind +): Eval> = + arrow.core.Eval.apply().run { + this@product.product(arg1) as + arrow.core.Eval> + } @JvmName("tupled") @Suppress( @@ -800,15 +797,15 @@ fun Kind tupled(arg0: Kind, arg1: Kind): Eval> = - arrow.core.Eval - .apply() - .tupled(arg0, arg1) as arrow.core.Eval> + arrow.core.Eval + .apply() + .tupled(arg0, arg1) as arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -820,15 +817,15 @@ fun tupled(arg0: Kind, arg1: Kind): Eval tupledN(arg0: Kind, arg1: Kind): Eval> = - arrow.core.Eval - .apply() - .tupledN(arg0, arg1) as arrow.core.Eval> + arrow.core.Eval + .apply() + .tupledN(arg0, arg1) as arrow.core.Eval> @JvmName("tupled") @Suppress( @@ -840,8 +837,8 @@ fun tupledN(arg0: Kind, arg1: Kind): Eval tupled( arg1: Kind, arg2: Kind ): Eval> = arrow.core.Eval - .apply() - .tupled(arg0, arg1, arg2) as arrow.core.Eval> + .apply() + .tupled(arg0, arg1, arg2) as arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -863,8 +860,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2)", - "arrow.core.Eval.tupledN" + "tupledN(arg0, arg1, arg2)", + "arrow.core.Eval.tupledN" ), DeprecationLevel.WARNING ) @@ -873,8 +870,8 @@ fun tupledN( arg1: Kind, arg2: Kind ): Eval> = arrow.core.Eval - .apply() - .tupledN(arg0, arg1, arg2) as arrow.core.Eval> + .apply() + .tupledN(arg0, arg1, arg2) as arrow.core.Eval> @JvmName("tupled") @Suppress( @@ -886,8 +883,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3)", - "arrow.core.Eval.tupled" + "tupled(arg0, arg1, arg2, arg3)", + "arrow.core.Eval.tupled" ), DeprecationLevel.WARNING ) @@ -897,8 +894,8 @@ fun tupled( arg2: Kind, arg3: Kind ): Eval> = arrow.core.Eval - .apply() - .tupled(arg0, arg1, arg2, arg3) as arrow.core.Eval> + .apply() + .tupled(arg0, arg1, arg2, arg3) as arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -910,8 +907,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3)", - "arrow.core.Eval.tupledN" + "tupledN(arg0, arg1, arg2, arg3)", + "arrow.core.Eval.tupledN" ), DeprecationLevel.WARNING ) @@ -921,8 +918,8 @@ fun tupledN( arg2: Kind, arg3: Kind ): Eval> = arrow.core.Eval - .apply() - .tupledN(arg0, arg1, arg2, arg3) as arrow.core.Eval> + .apply() + .tupledN(arg0, arg1, arg2, arg3) as arrow.core.Eval> @JvmName("tupled") @Suppress( @@ -934,8 +931,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval.tupled" + "tupled(arg0, arg1, arg2, arg3, arg4)", + "arrow.core.Eval.tupled" ), DeprecationLevel.WARNING ) @@ -946,9 +943,8 @@ fun tupled( arg3: Kind, arg4: Kind ): Eval> = arrow.core.Eval - .apply() - .tupled(arg0, arg1, arg2, arg3, arg4) as arrow.core.Eval> + .apply() + .tupled(arg0, arg1, arg2, arg3, arg4) as arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -960,8 +956,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval.tupledN" + "tupledN(arg0, arg1, arg2, arg3, arg4)", + "arrow.core.Eval.tupledN" ), DeprecationLevel.WARNING ) @@ -972,9 +968,8 @@ fun tupledN( arg3: Kind, arg4: Kind ): Eval> = arrow.core.Eval - .apply() - .tupledN(arg0, arg1, arg2, arg3, arg4) as arrow.core.Eval> + .apply() + .tupledN(arg0, arg1, arg2, arg3, arg4) as arrow.core.Eval> @JvmName("tupled") @Suppress( @@ -986,8 +981,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval.tupled" + "tupled(arg0, arg1, arg2, arg3, arg4, arg5)", + "arrow.core.Eval.tupled" ), DeprecationLevel.WARNING ) @@ -999,9 +994,9 @@ fun tupled( arg4: Kind, arg5: Kind ): Eval> = arrow.core.Eval - .apply() - .tupled(arg0, arg1, arg2, arg3, arg4, arg5) as - arrow.core.Eval> + .apply() + .tupled(arg0, arg1, arg2, arg3, arg4, arg5) as + arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -1013,8 +1008,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval.tupledN" + "tupledN(arg0, arg1, arg2, arg3, arg4, arg5)", + "arrow.core.Eval.tupledN" ), DeprecationLevel.WARNING ) @@ -1026,9 +1021,9 @@ fun tupledN( arg4: Kind, arg5: Kind ): Eval> = arrow.core.Eval - .apply() - .tupledN(arg0, arg1, arg2, arg3, arg4, arg5) as - arrow.core.Eval> + .apply() + .tupledN(arg0, arg1, arg2, arg3, arg4, arg5) as + arrow.core.Eval> @JvmName("tupled") @Suppress( @@ -1040,8 +1035,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval.tupled" + "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", + "arrow.core.Eval.tupled" ), DeprecationLevel.WARNING ) @@ -1054,9 +1049,9 @@ fun tupled( arg5: Kind, arg6: Kind ): Eval> = arrow.core.Eval - .apply() - .tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6) as - arrow.core.Eval> + .apply() + .tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6) as + arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -1068,8 +1063,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval.tupledN" + "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", + "arrow.core.Eval.tupledN" ), DeprecationLevel.WARNING ) @@ -1082,9 +1077,9 @@ fun tupledN( arg5: Kind, arg6: Kind ): Eval> = arrow.core.Eval - .apply() - .tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) as - arrow.core.Eval> + .apply() + .tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) as + arrow.core.Eval> @JvmName("tupled") @Suppress( @@ -1096,8 +1091,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval.tupled" + "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", + "arrow.core.Eval.tupled" ), DeprecationLevel.WARNING ) @@ -1111,9 +1106,9 @@ fun tupled( arg6: Kind, arg7: Kind ): Eval> = arrow.core.Eval - .apply() - .tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) as - arrow.core.Eval> + .apply() + .tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) as + arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -1125,8 +1120,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval.tupledN" + "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", + "arrow.core.Eval.tupledN" ), DeprecationLevel.WARNING ) @@ -1140,9 +1135,9 @@ fun tupledN( arg6: Kind, arg7: Kind ): Eval> = arrow.core.Eval - .apply() - .tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) as - arrow.core.Eval> + .apply() + .tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) as + arrow.core.Eval> @JvmName("tupled") @Suppress( @@ -1154,8 +1149,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval.tupled" + "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", + "arrow.core.Eval.tupled" ), DeprecationLevel.WARNING ) @@ -1170,9 +1165,9 @@ fun tupled( arg7: Kind, arg8: Kind ): Eval> = arrow.core.Eval - .apply() - .tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) as - arrow.core.Eval> + .apply() + .tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) as + arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -1184,8 +1179,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval.tupledN" + "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", + "arrow.core.Eval.tupledN" ), DeprecationLevel.WARNING ) @@ -1200,9 +1195,9 @@ fun tupledN( arg7: Kind, arg8: Kind ): Eval> = arrow.core.Eval - .apply() - .tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) as - arrow.core.Eval> + .apply() + .tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) as + arrow.core.Eval> @JvmName("tupled") @Suppress( @@ -1214,8 +1209,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval.tupled" + "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", + "arrow.core.Eval.tupled" ), DeprecationLevel.WARNING ) @@ -1231,10 +1226,9 @@ fun tupled( arg8: Kind, arg9: Kind ): Eval> = arrow.core.Eval - .apply() - .tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) as - arrow.core.Eval> + .apply() + .tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) as + arrow.core.Eval> @JvmName("tupledN") @Suppress( @@ -1246,8 +1240,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval.tupledN" + "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", + "arrow.core.Eval.tupledN" ), DeprecationLevel.WARNING ) @@ -1263,10 +1257,9 @@ fun tupledN( arg8: Kind, arg9: Kind ): Eval> = arrow.core.Eval - .apply() - .tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) as - arrow.core.Eval> + .apply() + .tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) as + arrow.core.Eval> @JvmName("followedBy") @Suppress( @@ -1278,15 +1271,15 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "followedBy(arg1)", - "arrow.core.followedBy" + "followedBy(arg1)", + "arrow.core.followedBy" ), DeprecationLevel.WARNING ) fun Kind.followedBy(arg1: Kind): Eval = - arrow.core.Eval.apply().run { - this@followedBy.followedBy(arg1) as arrow.core.Eval -} + arrow.core.Eval.apply().run { + this@followedBy.followedBy(arg1) as arrow.core.Eval + } @JvmName("apTap") @Suppress( @@ -1298,8 +1291,8 @@ fun Kind.followedBy(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "apTap(arg1)", - "arrow.core.apTap" + "apTap(arg1)", + "arrow.core.apTap" ), DeprecationLevel.WARNING ) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt index e261f1b21..46b0fd802 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt @@ -2,8 +2,6 @@ package arrow.core.extensions.eval.bimonad import arrow.core.Eval.Companion import arrow.core.extensions.EvalBimonad -import kotlin.PublishedApi -import kotlin.Suppress /** * cached extension diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt index d56f664c0..ddecaaf93 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt @@ -5,11 +5,6 @@ import arrow.core.Eval import arrow.core.Eval.Companion import arrow.core.ForEval import arrow.core.extensions.EvalComonad -import kotlin.Deprecated -import kotlin.Function1 -import kotlin.PublishedApi -import kotlin.Suppress -import kotlin.jvm.JvmName /** * cached extension @@ -27,15 +22,15 @@ internal val comonad_singleton: EvalComonad = object : arrow.core.extensions.Eva @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "coflatMap(arg1)", - "arrow.core.coflatMap" + "coflatMap(arg1)", + "arrow.core.coflatMap" ), DeprecationLevel.WARNING ) fun Kind.coflatMap(arg1: Function1, B>): Eval = - arrow.core.Eval.comonad().run { - this@coflatMap.coflatMap(arg1) as arrow.core.Eval -} + arrow.core.Eval.comonad().run { + this@coflatMap.coflatMap(arg1) as arrow.core.Eval + } @JvmName("extract") @Suppress( @@ -47,14 +42,15 @@ fun Kind.coflatMap(arg1: Function1, B>): Eva @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "extract()", - "arrow.core.extract" + "extract()", + "arrow.core.extract" ), DeprecationLevel.WARNING ) -fun Kind.extract(): A = arrow.core.Eval.comonad().run { - this@extract.extract() as A -} +fun Kind.extract(): A = + arrow.core.Eval.comonad().run { + this@extract.extract() as A + } @JvmName("duplicate") @Suppress( @@ -66,14 +62,15 @@ fun Kind.extract(): A = arrow.core.Eval.comonad().run { @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "duplicate()", - "arrow.core.duplicate" + "duplicate()", + "arrow.core.duplicate" ), DeprecationLevel.WARNING ) -fun Kind.duplicate(): Eval> = arrow.core.Eval.comonad().run { - this@duplicate.duplicate() as arrow.core.Eval> -} +fun Kind.duplicate(): Eval> = + arrow.core.Eval.comonad().run { + this@duplicate.duplicate() as arrow.core.Eval> + } @Suppress( "UNCHECKED_CAST", diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/functor/EvalFunctor.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/functor/EvalFunctor.kt index 329050508..a4c731529 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/functor/EvalFunctor.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/functor/EvalFunctor.kt @@ -6,12 +6,6 @@ import arrow.core.Eval.Companion import arrow.core.ForEval import arrow.core.Tuple2 import arrow.core.extensions.EvalFunctor -import kotlin.Deprecated -import kotlin.Function1 -import kotlin.PublishedApi -import kotlin.Suppress -import kotlin.Unit -import kotlin.jvm.JvmName /** * cached extension @@ -50,14 +44,15 @@ internal val functor_singleton: EvalFunctor = object : arrow.core.extensions.Eva @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg1)", - "arrow.core.map" + "map(arg1)", + "arrow.core.map" ), DeprecationLevel.WARNING ) -fun Kind.map(arg1: Function1): Eval = arrow.core.Eval.functor().run { - this@map.map(arg1) as arrow.core.Eval -} +fun Kind.map(arg1: Function1): Eval = + arrow.core.Eval.functor().run { + this@map.map(arg1) as arrow.core.Eval + } @JvmName("imap") @Suppress( @@ -69,15 +64,15 @@ fun Kind.map(arg1: Function1): Eval = arrow.core.Eva @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "imap(arg1, arg2)", - "arrow.core.imap" + "imap(arg1, arg2)", + "arrow.core.imap" ), DeprecationLevel.WARNING ) fun Kind.imap(arg1: Function1, arg2: Function1): Eval = - arrow.core.Eval.functor().run { - this@imap.imap(arg1, arg2) as arrow.core.Eval -} + arrow.core.Eval.functor().run { + this@imap.imap(arg1, arg2) as arrow.core.Eval + } /** * Lifts a function `A -> B` to the [F] structure returning a polymorphic function @@ -112,15 +107,15 @@ fun Kind.imap(arg1: Function1, arg2: Function1): @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "lift(arg0)", - "arrow.core.Eval.lift" + "lift(arg0)", + "arrow.core.Eval.lift" ), DeprecationLevel.WARNING ) fun lift(arg0: Function1): Function1, Kind> = - arrow.core.Eval - .functor() - .lift(arg0) as kotlin.Function1, + arrow.core.Eval + .functor() + .lift(arg0) as kotlin.Function1, arrow.Kind> @JvmName("void") @@ -133,14 +128,15 @@ fun lift(arg0: Function1): Function1, Kind Kind.void(): Eval = arrow.core.Eval.functor().run { - this@void.void() as arrow.core.Eval -} +fun Kind.void(): Eval = + arrow.core.Eval.functor().run { + this@void.void() as arrow.core.Eval + } /** * Applies [f] to an [A] inside [F] and returns the [F] structure with a tuple of the [A] value and the @@ -175,15 +171,15 @@ fun Kind.void(): Eval = arrow.core.Eval.functor().run { @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "fproduct(arg1)", - "arrow.core.fproduct" + "fproduct(arg1)", + "arrow.core.fproduct" ), DeprecationLevel.WARNING ) fun Kind.fproduct(arg1: Function1): Eval> = - arrow.core.Eval.functor().run { - this@fproduct.fproduct(arg1) as arrow.core.Eval> -} + arrow.core.Eval.functor().run { + this@fproduct.fproduct(arg1) as arrow.core.Eval> + } /** * Replaces [A] inside [F] with [B] resulting in a Kind @@ -217,14 +213,15 @@ fun Kind.fproduct(arg1: Function1): Eval> @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapConst(arg1)", - "arrow.core.mapConst" + "mapConst(arg1)", + "arrow.core.mapConst" ), DeprecationLevel.WARNING ) -fun Kind.mapConst(arg1: B): Eval = arrow.core.Eval.functor().run { - this@mapConst.mapConst(arg1) as arrow.core.Eval -} +fun Kind.mapConst(arg1: B): Eval = + arrow.core.Eval.functor().run { + this@mapConst.mapConst(arg1) as arrow.core.Eval + } /** * Replaces the [B] value inside [F] with [A] resulting in a Kind @@ -239,14 +236,15 @@ fun Kind.mapConst(arg1: B): Eval = arrow.core.Eval.functor @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapConst(arg1)", - "arrow.core.mapConst" + "mapConst(arg1)", + "arrow.core.mapConst" ), DeprecationLevel.WARNING ) -fun A.mapConst(arg1: Kind): Eval = arrow.core.Eval.functor().run { - this@mapConst.mapConst(arg1) as arrow.core.Eval -} +fun A.mapConst(arg1: Kind): Eval = + arrow.core.Eval.functor().run { + this@mapConst.mapConst(arg1) as arrow.core.Eval + } /** * Pairs [B] with [A] returning a Kind> @@ -280,14 +278,15 @@ fun A.mapConst(arg1: Kind): Eval = arrow.core.Eval.functor @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupleLeft(arg1)", - "arrow.core.tupleLeft" + "tupleLeft(arg1)", + "arrow.core.tupleLeft" ), DeprecationLevel.WARNING ) -fun Kind.tupleLeft(arg1: B): Eval> = arrow.core.Eval.functor().run { - this@tupleLeft.tupleLeft(arg1) as arrow.core.Eval> -} +fun Kind.tupleLeft(arg1: B): Eval> = + arrow.core.Eval.functor().run { + this@tupleLeft.tupleLeft(arg1) as arrow.core.Eval> + } /** * Pairs [A] with [B] returning a Kind> @@ -321,15 +320,15 @@ fun Kind.tupleLeft(arg1: B): Eval> = arrow.core. @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupleRight(arg1)", - "arrow.core.tupleRight" + "tupleRight(arg1)", + "arrow.core.tupleRight" ), DeprecationLevel.WARNING ) fun Kind.tupleRight(arg1: B): Eval> = - arrow.core.Eval.functor().run { - this@tupleRight.tupleRight(arg1) as arrow.core.Eval> -} + arrow.core.Eval.functor().run { + this@tupleRight.tupleRight(arg1) as arrow.core.Eval> + } /** * Given [A] is a sub type of [B], re-type this value from Kind to Kind @@ -364,14 +363,15 @@ fun Kind.tupleRight(arg1: B): Eval> = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "widen()", - "arrow.core.widen" + "widen()", + "arrow.core.widen" ), DeprecationLevel.WARNING ) -fun Kind.widen(): Eval = arrow.core.Eval.functor().run { - this@widen.widen() as arrow.core.Eval -} +fun Kind.widen(): Eval = + arrow.core.Eval.functor().run { + this@widen.widen() as arrow.core.Eval + } @Suppress( "UNCHECKED_CAST", diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/monad/EvalMonad.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/monad/EvalMonad.kt index dac806fbe..6f9cb0b6e 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/monad/EvalMonad.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/monad/EvalMonad.kt @@ -7,13 +7,6 @@ import arrow.core.Eval.Companion import arrow.core.ForEval import arrow.core.Tuple2 import arrow.core.extensions.EvalMonad -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Function0 -import kotlin.Function1 -import kotlin.PublishedApi -import kotlin.Suppress -import kotlin.jvm.JvmName /** * cached extension @@ -31,15 +24,15 @@ internal val monad_singleton: EvalMonad = object : arrow.core.extensions.EvalMon @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "flatMap(arg1)", - "arrow.core.flatMap" + "flatMap(arg1)", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) fun Kind.flatMap(arg1: Function1>): Eval = - arrow.core.Eval.monad().run { - this@flatMap.flatMap(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@flatMap.flatMap(arg1) as arrow.core.Eval + } @JvmName("tailRecM") @Suppress( @@ -51,15 +44,15 @@ fun Kind.flatMap(arg1: Function1>): Eval< @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tailRecM(arg0, arg1)", - "arrow.core.Eval.tailRecM" + "tailRecM(arg0, arg1)", + "arrow.core.Eval.tailRecM" ), DeprecationLevel.WARNING ) fun tailRecM(arg0: A, arg1: Function1>>): Eval = - arrow.core.Eval - .monad() - .tailRecM(arg0, arg1) as arrow.core.Eval + arrow.core.Eval + .monad() + .tailRecM(arg0, arg1) as arrow.core.Eval @JvmName("map") @Suppress( @@ -71,14 +64,15 @@ fun tailRecM(arg0: A, arg1: Function1>>): E @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg1)", - "arrow.core.map" + "map(arg1)", + "arrow.core.map" ), DeprecationLevel.WARNING ) -fun Kind.map(arg1: Function1): Eval = arrow.core.Eval.monad().run { - this@map.map(arg1) as arrow.core.Eval -} +fun Kind.map(arg1: Function1): Eval = + arrow.core.Eval.monad().run { + this@map.map(arg1) as arrow.core.Eval + } /** * @see [Apply.ap] @@ -93,15 +87,15 @@ fun Kind.map(arg1: Function1): Eval = arrow.core.Eva @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "ap(arg1)", - "arrow.core.ap" + "ap(arg1)", + "arrow.core.ap" ), DeprecationLevel.WARNING ) fun Kind.ap(arg1: Kind>): Eval = - arrow.core.Eval.monad().run { - this@ap.ap(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@ap.ap(arg1) as arrow.core.Eval + } @JvmName("flatten") @Suppress( @@ -113,14 +107,15 @@ fun Kind.ap(arg1: Kind>): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "flatten()", - "arrow.core.flatten" + "flatten()", + "arrow.core.flatten" ), DeprecationLevel.WARNING ) -fun Kind>.flatten(): Eval = arrow.core.Eval.monad().run { - this@flatten.flatten() as arrow.core.Eval -} +fun Kind>.flatten(): Eval = + arrow.core.Eval.monad().run { + this@flatten.flatten() as arrow.core.Eval + } @JvmName("followedBy") @Suppress( @@ -132,15 +127,15 @@ fun Kind>.flatten(): Eval = arrow.core.Eval.mon @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "followedBy(arg1)", - "arrow.core.followedBy" + "followedBy(arg1)", + "arrow.core.followedBy" ), DeprecationLevel.WARNING ) fun Kind.followedBy(arg1: Kind): Eval = - arrow.core.Eval.monad().run { - this@followedBy.followedBy(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@followedBy.followedBy(arg1) as arrow.core.Eval + } @JvmName("apTap") @Suppress( @@ -152,14 +147,15 @@ fun Kind.followedBy(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "apTap(arg1)", - "arrow.core.apTap" + "apTap(arg1)", + "arrow.core.apTap" ), DeprecationLevel.WARNING ) -fun Kind.apTap(arg1: Kind): Eval = arrow.core.Eval.monad().run { - this@apTap.apTap(arg1) as arrow.core.Eval -} +fun Kind.apTap(arg1: Kind): Eval = + arrow.core.Eval.monad().run { + this@apTap.apTap(arg1) as arrow.core.Eval + } @JvmName("followedByEval") @Suppress( @@ -171,15 +167,15 @@ fun Kind.apTap(arg1: Kind): Eval = arrow.core. @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "followedByEval(arg1)", - "arrow.core.followedByEval" + "followedByEval(arg1)", + "arrow.core.followedByEval" ), DeprecationLevel.WARNING ) fun Kind.followedByEval(arg1: Eval>): Eval = - arrow.core.Eval.monad().run { - this@followedByEval.followedByEval(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@followedByEval.followedByEval(arg1) as arrow.core.Eval + } @JvmName("effectM") @Suppress( @@ -191,15 +187,15 @@ fun Kind.followedByEval(arg1: Eval>): Eval Kind.effectM(arg1: Function1>): Eval = - arrow.core.Eval.monad().run { - this@effectM.effectM(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@effectM.effectM(arg1) as arrow.core.Eval + } @JvmName("flatTap") @Suppress( @@ -211,15 +207,15 @@ fun Kind.effectM(arg1: Function1>): Eval< @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "flatTap(arg1)", - "arrow.core.flatTap" + "flatTap(arg1)", + "arrow.core.flatTap" ), DeprecationLevel.WARNING ) fun Kind.flatTap(arg1: Function1>): Eval = - arrow.core.Eval.monad().run { - this@flatTap.flatTap(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@flatTap.flatTap(arg1) as arrow.core.Eval + } @JvmName("productL") @Suppress( @@ -231,15 +227,15 @@ fun Kind.flatTap(arg1: Function1>): Eval< @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "productL(arg1)", - "arrow.core.productL" + "productL(arg1)", + "arrow.core.productL" ), DeprecationLevel.WARNING ) fun Kind.productL(arg1: Kind): Eval = - arrow.core.Eval.monad().run { - this@productL.productL(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@productL.productL(arg1) as arrow.core.Eval + } @JvmName("forEffect") @Suppress( @@ -251,15 +247,15 @@ fun Kind.productL(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "forEffect(arg1)", - "arrow.core.forEffect" + "forEffect(arg1)", + "arrow.core.forEffect" ), DeprecationLevel.WARNING ) fun Kind.forEffect(arg1: Kind): Eval = - arrow.core.Eval.monad().run { - this@forEffect.forEffect(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@forEffect.forEffect(arg1) as arrow.core.Eval + } @JvmName("productLEval") @Suppress( @@ -271,15 +267,15 @@ fun Kind.forEffect(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "productLEval(arg1)", - "arrow.core.productLEval" + "productLEval(arg1)", + "arrow.core.productLEval" ), DeprecationLevel.WARNING ) fun Kind.productLEval(arg1: Eval>): Eval = - arrow.core.Eval.monad().run { - this@productLEval.productLEval(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@productLEval.productLEval(arg1) as arrow.core.Eval + } @JvmName("forEffectEval") @Suppress( @@ -291,15 +287,15 @@ fun Kind.productLEval(arg1: Eval>): Eval @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "forEffectEval(arg1)", - "arrow.core.forEffectEval" + "forEffectEval(arg1)", + "arrow.core.forEffectEval" ), DeprecationLevel.WARNING ) fun Kind.forEffectEval(arg1: Eval>): Eval = - arrow.core.Eval.monad().run { - this@forEffectEval.forEffectEval(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@forEffectEval.forEffectEval(arg1) as arrow.core.Eval + } @JvmName("mproduct") @Suppress( @@ -311,15 +307,15 @@ fun Kind.forEffectEval(arg1: Eval>): Eval @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mproduct(arg1)", - "arrow.core.mproduct" + "mproduct(arg1)", + "arrow.core.mproduct" ), DeprecationLevel.WARNING ) fun Kind.mproduct(arg1: Function1>): Eval> = - arrow.core.Eval.monad().run { - this@mproduct.mproduct(arg1) as arrow.core.Eval> -} + arrow.core.Eval.monad().run { + this@mproduct.mproduct(arg1) as arrow.core.Eval> + } @JvmName("ifM") @Suppress( @@ -331,8 +327,8 @@ fun Kind.mproduct(arg1: Function1>): Eval @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "ifM(arg1, arg2)", - "arrow.core.ifM" + "ifM(arg1, arg2)", + "arrow.core.ifM" ), DeprecationLevel.WARNING ) @@ -353,15 +349,15 @@ fun Kind.ifM( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "selectM(arg1)", - "arrow.core.selectM" + "selectM(arg1)", + "arrow.core.selectM" ), DeprecationLevel.WARNING ) fun Kind>.selectM(arg1: Kind>): Eval = - arrow.core.Eval.monad().run { - this@selectM.selectM(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@selectM.selectM(arg1) as arrow.core.Eval + } @JvmName("select") @Suppress( @@ -373,15 +369,15 @@ fun Kind>.selectM(arg1: Kind Kind>.select(arg1: Kind>): Eval = - arrow.core.Eval.monad().run { - this@select.select(arg1) as arrow.core.Eval -} + arrow.core.Eval.monad().run { + this@select.select(arg1) as arrow.core.Eval + } /** * [Monad] abstract over the ability to declare sequential computations that are dependent in the order or From 42146c747f9bcb71f82861f255991443d254328b Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 11:17:59 +0100 Subject: [PATCH 08/24] Move mapN to companion object Deprecate extension methods for EvalApply.kt --- .../src/main/kotlin/arrow/core/Eval.kt | 261 +++++++++--------- .../core/extensions/eval/apply/EvalApply.kt | 194 ++++++------- 2 files changed, 235 insertions(+), 220 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 13ed004ef..ee4de50ec 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -1,6 +1,6 @@ package arrow.core -import arrow.core.Eval.Companion.just +import arrow.Kind import arrow.typeclasses.Monoid import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement @@ -249,123 +249,116 @@ sealed class Eval : EvalOf { return curr.value() as A } - } - - abstract fun value(): A - - abstract fun memoize(): Eval - inline fun map(crossinline f: (A) -> B): Eval = - flatMap { a -> Now(f(a)) } - - inline fun mapN( - a: Eval, - b: Eval, - crossinline map: (A, B) -> C - ): Eval = - mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { b, c, _, _, _, _, _, _, _, _ -> map(b, c) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - crossinline map: (A, B, C) -> D - ): Eval = - mapN(a, b, c, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { b, c, d, _, _, _, _, _, _, _ -> map(b, c, d) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - crossinline map: (A, B, C, D) -> E - ): Eval = - mapN(a, b, c, d, Unit, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, _, _, _, _, _, _ -> map(a, b, c, d) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - crossinline map: (A, B, C, D, E) -> F - ): Eval = - mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, e, _, _, _, _, _ -> map(a, b, c, d, e) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - crossinline map: (A, B, C, D, E, F) -> G - ): Eval = - mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { a, b, c, d, e, f, _, _, _, _ -> map(a, b, c, d, e, f) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - crossinline map: (A, B, C, D, E, F, G) -> H - ): Eval = - mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { a, b, c, d, e, f, g, _, _, _ -> map(a, b, c, d, e, f, g) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - crossinline map: (A, B, C, D, E, F, G, H) -> I - ): Eval = - mapN(a, b, c, d, e, f, g, h, Unit, Unit) { a, b, c, d, e, f, g, h, _, _ -> map(a, b, c, d, e, f, g, h) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - i: Eval, - crossinline map: (A, B, C, D, E, F, G, H, I) -> J - ): Eval = - mapN(a, b, c, d, e, f, g, h, i, Unit) { a, b, c, d, e, f, g, h, i, _ -> map(a, b, c, d, e, f, g, h, i) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - i: Eval, - j: Eval, - crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K - ): Eval = - a.flatMap { aa -> - b.flatMap { bb -> - c.flatMap { cc -> - d.flatMap { dd -> - e.flatMap { ee -> - f.flatMap { ff -> - g.flatMap { gg -> - h.flatMap { hh -> - i.flatMap { ii -> - j.map { jj -> - map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) + inline fun mapN( + a: Eval, + b: Eval, + crossinline map: (A, B) -> C + ): Eval = + mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { b, c, _, _, _, _, _, _, _, _ -> map(b, c) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + crossinline map: (A, B, C) -> D + ): Eval = + mapN(a, b, c, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { b, c, d, _, _, _, _, _, _, _ -> map(b, c, d) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + crossinline map: (A, B, C, D) -> E + ): Eval = + mapN(a, b, c, d, Unit, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, _, _, _, _, _, _ -> map(a, b, c, d) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + crossinline map: (A, B, C, D, E) -> F + ): Eval = + mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, e, _, _, _, _, _ -> map(a, b, c, d, e) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + crossinline map: (A, B, C, D, E, F) -> G + ): Eval = + mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { a, b, c, d, e, f, _, _, _, _ -> map(a, b, c, d, e, f) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + crossinline map: (A, B, C, D, E, F, G) -> H + ): Eval = + mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { a, b, c, d, e, f, g, _, _, _ -> map(a, b, c, d, e, f, g) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + crossinline map: (A, B, C, D, E, F, G, H) -> I + ): Eval = + mapN(a, b, c, d, e, f, g, h, Unit, Unit) { a, b, c, d, e, f, g, h, _, _ -> map(a, b, c, d, e, f, g, h) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + i: Eval, + crossinline map: (A, B, C, D, E, F, G, H, I) -> J + ): Eval = + mapN(a, b, c, d, e, f, g, h, i, Unit) { a, b, c, d, e, f, g, h, i, _ -> map(a, b, c, d, e, f, g, h, i) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + i: Eval, + j: Eval, + crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K + ): Eval = + a.flatMap { aa -> + b.flatMap { bb -> + c.flatMap { cc -> + d.flatMap { dd -> + e.flatMap { ee -> + f.flatMap { ff -> + g.flatMap { gg -> + h.flatMap { hh -> + i.flatMap { ii -> + j.map { jj -> + map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) + } } } } @@ -375,11 +368,26 @@ sealed class Eval : EvalOf { } } } - } + } + abstract fun value(): A + + abstract fun memoize(): Eval + + inline fun map(crossinline f: (A) -> B): Eval = + flatMap { a -> Now(f(a)) } + + @Deprecated( + "Kind is deprecated, and will be removed in 0.13.0. Please use the ap method defined for Eval instead", + ReplaceWith("ap(ff)"), + DeprecationLevel.WARNING + ) fun ap(ff: EvalOf<(A) -> B>): Eval = ff.fix().flatMap { f -> map(f) }.fix() + fun ap(ff: Eval<(A) -> B>): Eval = + ff.flatMap { f -> map(f) } + @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE", "UNCHECKED_CAST") inline fun flatMap(crossinline f: (A) -> EvalOf): Eval = when (this) { @@ -500,16 +508,21 @@ fun Iterator.iterateRight(lb: Eval, f: (A, Eval) -> Eval): Ev } fun Eval.zip(fb: Eval, f: (A, B) -> Z): Eval = - flatMap { a: A -> fb.map { b -> f(a, b) } } + flatMap { a: A -> fb.map { b: B -> f(a, b) } } fun Eval.zip(fb: Eval): Eval> = - flatMap { a: A -> fb.map { b -> Pair(a, b) } } + flatMap { a: A -> fb.map { b: B -> Pair(a, b) } } fun Eval.replicate(n: Int): Eval> = - if (n <= 0) just(emptyList()) - else mapN(this, replicate(n - 1)) { a: A, xs: List -> listOf(a) + xs } + if (n <= 0) Eval.just(emptyList()) + else Eval.mapN(this, replicate(n - 1)) { a: A, xs: List -> listOf(a) + xs } fun Eval.replicate(n: Int, MA: Monoid): Eval = MA.run { - if (n <= 0) just(MA.empty()) - else mapN(this@replicate, replicate(n - 1, MA)) { a: A, xs: A -> MA.run { a + xs } } + if (n <= 0) Eval.just(MA.empty()) + else Eval.mapN(this@replicate, replicate(n - 1, MA)) { a: A, xs: A -> MA.run { a + xs } } } + +fun Eval.apEval(ff: Eval B>>): Eval> = ff.map { this.ap(it) } + +fun Eval.map2Eval(fb: Eval>, f: (Tuple2) -> Z): Eval> = + apEval(fb.map { it.map { b: B -> { a: A -> f(Tuple2(a, b)) } } }) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt index 4b94e7c0f..d09118307 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt @@ -93,8 +93,8 @@ fun Kind.map2Eval( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -116,8 +116,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -139,8 +139,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2, arg3)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -163,8 +163,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2, arg3)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -187,8 +187,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -212,8 +212,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -237,8 +237,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -263,8 +263,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -289,8 +289,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -316,8 +316,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -343,8 +343,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -372,8 +372,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -401,8 +401,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -431,8 +431,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -461,8 +461,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -492,8 +492,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -523,8 +523,8 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", - "arrow.core.Eval.map" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -555,8 +555,8 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", - "arrow.core.Eval.mapN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -587,8 +587,9 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "map2(arg1, arg2)", - "arrow.core.map2" + "Eval.mapN(this, fb) { a, b -> Tuple2(a, b) }.map(f)", + "arrow.core.map", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -607,8 +608,8 @@ fun Kind.map2(arg1: Kind, arg2: Function1 Tuple2(a, b) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -627,8 +628,8 @@ fun Kind.product(arg1: Kind): Eval> @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "Eval.mapN(this, fb) { (ab, c) -> Tuple3(ab.a, ab.b, c) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -647,8 +648,8 @@ fun Kind>.product(arg1: Kind): Eval< @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "Eval.mapN(this, fb) { (abc, d) -> Tuple4(abc.a, abc.b, abc.c, d) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -667,8 +668,8 @@ fun Kind>.product(arg1: Kind): @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "Eval.mapN(this, fb) { (abcd, e) -> Tuple5(abcd.a, abcd.b, abcd.c, abcd.d, e) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -688,8 +689,8 @@ fun Kind>.product( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "Eval.mapN(this, fb) { (abcde, f) -> Tuple6(abcde.a, abcde.b, abcde.c, abcde.d, abcde.e, f) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -709,8 +710,8 @@ fun Kind>.product( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "Eval.mapN(this, fb) { (abcdef, g) -> Tuple7(abcdef.a, abcdef.b, abcdef.c, abcdef.d, abcdef.e, abcdef.f, g) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -730,8 +731,8 @@ fun Kind>.product( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "Eval.mapN(this, fb) { (abcdefg, h) -> Tuple8(abcdefg.a, abcdefg.b, abcdefg.c, abcdefg.d, abcdefg.e, abcdefg.f, abcdefg.g, h) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -752,8 +753,8 @@ fun Kind>.produc @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "Eval.mapN(this, fb) { (abcdefgh, i) -> Tuple9(abcdefgh.a, abcdefgh.b, abcdefgh.c, abcdefgh.d, abcdefgh.e, abcdefgh.f, abcdefgh.g, abcdefgh.h, i) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -774,8 +775,8 @@ fun Kind>. @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "product(arg1)", - "arrow.core.product" + "Eval.mapN(this, fb) { (abcdefghi, j) -> Tuple10(abcdefghi.a, abcdefghi.b, abcdefghi.c, abcdefghi.d, abcdefghi.e, abcdefghi.f, abcdefghi.g, abcdefghi.h, abcdefghi.i, j) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -797,8 +798,8 @@ fun Kind Tuple2(a, b) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -817,8 +818,8 @@ fun tupled(arg0: Kind, arg1: Kind): Eval Tuple2(a, b) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -837,8 +838,8 @@ fun tupledN(arg0: Kind, arg1: Kind): Eval Tuple3(a, b, c) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -860,8 +861,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2)", - "arrow.core.Eval.tupledN" + "Eval.mapN(arg0, arg1, arg2) { a, b, c -> Tuple3(a, b, c) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -883,8 +884,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3)", - "arrow.core.Eval.tupled" + "Eval.mapN(arg0, arg1, arg2, arg3) { a, b, c, d -> Tuple4(a, b, c, d) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -907,8 +908,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3)", - "arrow.core.Eval.tupledN" + "Eval.mapN(arg0, arg1, arg2, arg3) { a, b, c, d -> Tuple4(a, b, c, d) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -931,8 +932,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval.tupled" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4) { a, b, c, d, e -> Tuple5(a, b, c, d, e) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -956,8 +957,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval.tupledN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4) { a, b, c, d, e -> Tuple5(a, b, c, d, e) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -981,8 +982,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval.tupled" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5) { a, b, c, d, e, ff -> Tuple6(a, b, c, d, e, ff) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1008,8 +1009,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval.tupledN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5) { a, b, c, d, e, ff -> Tuple6(a, b, c, d, e, ff) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1035,8 +1036,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval.tupled" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { a, b, c, d, e, ff, g -> Tuple7(a, b, c, d, e, ff, g) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1063,8 +1064,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval.tupledN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { a, b, c, d, e, ff, g -> Tuple7(a, b, c, d, e, ff, g) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1091,8 +1092,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval.tupled" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { a, b, c, d, e, ff, g, h -> Tuple8(a, b, c, d, e, ff, g, h) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1120,8 +1121,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval.tupledN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { a, b, c, d, e, ff, g, h -> Tuple8(a, b, c, d, e, ff, g, h) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1149,8 +1150,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval.tupled" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { a, b, c, d, e, ff, g, h, i -> Tuple9(a, b, c, d, e, ff, g, h, i) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1179,8 +1180,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval.tupledN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { a, b, c, d, e, ff, g, h, i -> Tuple9(a, b, c, d, e, ff, g, h, i) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1209,8 +1210,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupled(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval.tupled" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { a, b, c, d, e, ff, g, h, i, j -> Tuple10(a, b, c, d, e, ff, g, h, i, j) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1240,8 +1241,8 @@ fun tupled( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupledN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval.tupledN" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { a, b, c, d, e, ff, g, h, i, j -> Tuple10(a, b, c, d, e, ff, g, h, i, j) }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1271,8 +1272,8 @@ fun tupledN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "followedBy(arg1)", - "arrow.core.followedBy" + "Eval.mapN(this, fb) { _, right -> right }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1291,8 +1292,8 @@ fun Kind.followedBy(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "apTap(arg1)", - "arrow.core.apTap" + "Eval.mapN(this, fb) { left, _ -> left }", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -1304,4 +1305,5 @@ fun Kind.apTap(arg1: Kind): Eval = arrow.core. "UNCHECKED_CAST", "NOTHING_TO_INLINE" ) +@Deprecated("Apply typeclass is deprecated. Use concrete methods on Eval") inline fun Companion.apply(): EvalApply = apply_singleton From 5e96e16b750853a7023fd3b3ce7cac15f96c3f1a Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 11:30:38 +0100 Subject: [PATCH 09/24] Deprecate extension methods for EvalBimonad.kt --- .../kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt index 46b0fd802..0895ca07a 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/bimonad/EvalBimonad.kt @@ -13,4 +13,5 @@ internal val bimonad_singleton: EvalBimonad = object : arrow.core.extensions.Eva "UNCHECKED_CAST", "NOTHING_TO_INLINE" ) +@Deprecated("Bimonad typeclass is deprecated. Use concrete methods on Eval") inline fun Companion.bimonad(): EvalBimonad = bimonad_singleton From 68e5714d662d6e755993a9f4f5400e5f583819b3 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 11:36:20 +0100 Subject: [PATCH 10/24] Deprecate extension methods for EvalComonad.kt --- arrow-core-data/src/main/kotlin/arrow/core/Eval.kt | 9 +++++++++ .../arrow/core/extensions/eval/comonad/EvalComonad.kt | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index ee4de50ec..3fb460bee 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -411,9 +411,18 @@ sealed class Eval : EvalOf { } } + @JvmName("coflatMap_") + @Deprecated( + "Kind is deprecated, and will be removed in 0.13.0. Please use the coflatMap method defined for Eval instead", + ReplaceWith("coflatMap(f)"), + DeprecationLevel.WARNING + ) inline fun coflatMap(crossinline f: (EvalOf) -> B): Eval = Later { f(this) } + inline fun coflatMap(crossinline f: (Eval) -> B): Eval = + Later { f(this) } + fun extract(): A = value() /** diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt index ddecaaf93..7734e0644 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt @@ -62,8 +62,8 @@ fun Kind.extract(): A = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "duplicate()", - "arrow.core.duplicate" + "coflatMap(::identity)", + "arrow.core.coflatMap" ), DeprecationLevel.WARNING ) @@ -76,4 +76,5 @@ fun Kind.duplicate(): Eval> = "UNCHECKED_CAST", "NOTHING_TO_INLINE" ) +@Deprecated("Comonad typeclass is deprecated. Use concrete methods on Eval") inline fun Companion.comonad(): EvalComonad = comonad_singleton From 9cadbe890902de207cdbd60cf1c5ef1cb1b9c599 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 11:46:20 +0100 Subject: [PATCH 11/24] Deprecate extension methods for EvalFunctor.kt --- .../src/main/kotlin/arrow/core/Eval.kt | 1 - .../extensions/eval/functor/EvalFunctor.kt | 43 ++++++++----------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 3fb460bee..be25625ed 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -1,6 +1,5 @@ package arrow.core -import arrow.Kind import arrow.typeclasses.Monoid import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/functor/EvalFunctor.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/functor/EvalFunctor.kt index a4c731529..4fd6b1ac4 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/functor/EvalFunctor.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/functor/EvalFunctor.kt @@ -64,8 +64,8 @@ fun Kind.map(arg1: Function1): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "imap(arg1, arg2)", - "arrow.core.imap" + "map(arg1)", + "arrow.core.map" ), DeprecationLevel.WARNING ) @@ -104,14 +104,7 @@ fun Kind.imap(arg1: Function1, arg2: Function1): "EXTENSION_SHADOWED_BY_MEMBER", "UNUSED_PARAMETER" ) -@Deprecated( - "@extension kinded projected functions are deprecated", - ReplaceWith( - "lift(arg0)", - "arrow.core.Eval.lift" - ), - DeprecationLevel.WARNING -) +@Deprecated("Kind/type constructors will be deprecated, so this typeclass will no longer be available from 0.13.0") fun lift(arg0: Function1): Function1, Kind> = arrow.core.Eval .functor() @@ -128,8 +121,8 @@ fun lift(arg0: Function1): Function1, Kind Kind.void(): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "fproduct(arg1)", - "arrow.core.fproduct" + "map { a -> Tuple2(a, f(a)) }", + "arrow.core.map" ), DeprecationLevel.WARNING ) @@ -213,8 +206,8 @@ fun Kind.fproduct(arg1: Function1): Eval> @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapConst(arg1)", - "arrow.core.mapConst" + "map { arg1 }", + "arrow.core.map" ), DeprecationLevel.WARNING ) @@ -236,8 +229,8 @@ fun Kind.mapConst(arg1: B): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mapConst(arg1)", - "arrow.core.mapConst" + "map { arg1 }", + "arrow.core.map" ), DeprecationLevel.WARNING ) @@ -278,8 +271,8 @@ fun A.mapConst(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupleLeft(arg1)", - "arrow.core.tupleLeft" + "map { a -> Tuple2(arg1, a) }", + "arrow.core.map" ), DeprecationLevel.WARNING ) @@ -320,8 +313,8 @@ fun Kind.tupleLeft(arg1: B): Eval> = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tupleRight(arg1)", - "arrow.core.tupleRight" + "map { a -> Tuple2(a, arg1) }", + "arrow.core.map" ), DeprecationLevel.WARNING ) @@ -362,10 +355,7 @@ fun Kind.tupleRight(arg1: B): Eval> = ) @Deprecated( "@extension kinded projected functions are deprecated", - ReplaceWith( - "widen()", - "arrow.core.widen" - ), + ReplaceWith("this"), DeprecationLevel.WARNING ) fun Kind.widen(): Eval = @@ -377,4 +367,5 @@ fun Kind.widen(): Eval = "UNCHECKED_CAST", "NOTHING_TO_INLINE" ) +@Deprecated("Functor typeclass is deprecated. Use concrete methods on Eval") inline fun Companion.functor(): EvalFunctor = functor_singleton From cfb4630a4bba00ce52ca8227f12188eb9cafe8fb Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 12:16:39 +0100 Subject: [PATCH 12/24] Deprecate extension methods for EvalMonad.kt --- .../src/main/kotlin/arrow/core/Eval.kt | 58 +++++++++++++++---- .../core/extensions/eval/monad/EvalMonad.kt | 53 ++++++++--------- 2 files changed, 75 insertions(+), 36 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index be25625ed..94a9feba2 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -1,5 +1,6 @@ package arrow.core +import arrow.Kind import arrow.typeclasses.Monoid import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement @@ -73,6 +74,12 @@ sealed class Eval : EvalOf { companion object { + @JvmName("tailRecM_") + @Deprecated( + "Kind is deprecated, and will be removed in 0.13.0. Please use the tailRecM method defined for Eval instead", + ReplaceWith("tailRecM(f)"), + DeprecationLevel.WARNING + ) fun tailRecM(a: A, f: (A) -> EvalOf>): Eval = f(a).fix().flatMap { eval: Either -> when (eval) { @@ -81,6 +88,14 @@ sealed class Eval : EvalOf { } } + fun tailRecM(a: A, f: (A) -> Eval>): Eval = + f(a).flatMap { eval: Either -> + when (eval) { + is Either.Left -> tailRecM(eval.a, f) + is Either.Right -> just(eval.b) + } + } + fun just(a: A): Eval = now(a) @@ -376,17 +391,15 @@ sealed class Eval : EvalOf { inline fun map(crossinline f: (A) -> B): Eval = flatMap { a -> Now(f(a)) } - @Deprecated( - "Kind is deprecated, and will be removed in 0.13.0. Please use the ap method defined for Eval instead", - ReplaceWith("ap(ff)"), - DeprecationLevel.WARNING - ) + @Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use the ap method defined for Eval instead") fun ap(ff: EvalOf<(A) -> B>): Eval = ff.fix().flatMap { f -> map(f) }.fix() fun ap(ff: Eval<(A) -> B>): Eval = ff.flatMap { f -> map(f) } + @JvmName("flatMap_") + @Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use the flatMap method defined for Eval instead") @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE", "UNCHECKED_CAST") inline fun flatMap(crossinline f: (A) -> EvalOf): Eval = when (this) { @@ -410,12 +423,31 @@ sealed class Eval : EvalOf { } } + @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE", "UNCHECKED_CAST") + inline fun flatMap(crossinline f: (A) -> Eval): Eval = + when (this) { + is FlatMap -> object : FlatMap() { + override fun start(): Eval = (this@Eval).start() + + @IgnoreJRERequirement + override fun run(s: S): Eval = + object : FlatMap() { + override fun start(): Eval = (this@Eval).run(s) as Eval + override fun run(s1: S1): Eval = f(s1 as A).fix() + } + } + is Defer -> object : FlatMap() { + override fun start(): Eval = this@Eval.thunk() as Eval + override fun run(s: S): Eval = f(s as A).fix() + } + else -> object : FlatMap() { + override fun start(): Eval = this@Eval as Eval + override fun run(s: S): Eval = f(s as A).fix() + } + } + @JvmName("coflatMap_") - @Deprecated( - "Kind is deprecated, and will be removed in 0.13.0. Please use the coflatMap method defined for Eval instead", - ReplaceWith("coflatMap(f)"), - DeprecationLevel.WARNING - ) + @Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use the coflatMap method defined for Eval instead") inline fun coflatMap(crossinline f: (EvalOf) -> B): Eval = Later { f(this) } @@ -534,3 +566,9 @@ fun Eval.apEval(ff: Eval B>>): Eval> = ff.map { th fun Eval.map2Eval(fb: Eval>, f: (Tuple2) -> Z): Eval> = apEval(fb.map { it.map { b: B -> { a: A -> f(Tuple2(a, b)) } } }) + +fun Eval.apTap(fb: Eval): Eval = + flatTap { fb } + +fun Eval.flatTap(f: (A) -> Eval): Eval = + flatMap { a -> f(a).map { a } } diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/monad/EvalMonad.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/monad/EvalMonad.kt index 6f9cb0b6e..16301ed2f 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/monad/EvalMonad.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/monad/EvalMonad.kt @@ -44,8 +44,8 @@ fun Kind.flatMap(arg1: Function1>): Eval< @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "tailRecM(arg0, arg1)", - "arrow.core.Eval.tailRecM" + "Eval.tailRecM(arg0, arg1)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -107,8 +107,8 @@ fun Kind.ap(arg1: Kind>): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "flatten()", - "arrow.core.flatten" + "flatMap(::identity)", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -127,8 +127,8 @@ fun Kind>.flatten(): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "followedBy(arg1)", - "arrow.core.followedBy" + "flatMap { arg1 }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -167,8 +167,8 @@ fun Kind.apTap(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "followedByEval(arg1)", - "arrow.core.followedByEval" + "flatMap { arg1.value() }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -187,8 +187,8 @@ fun Kind.followedByEval(arg1: Eval>): Eval Kind.flatTap(arg1: Function1>): Eval< @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "productL(arg1)", - "arrow.core.productL" + "flatMap { a -> arg1.map { a } }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -247,8 +247,8 @@ fun Kind.productL(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "forEffect(arg1)", - "arrow.core.forEffect" + "flatMap { a -> arg1.map { a } }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -267,8 +267,8 @@ fun Kind.forEffect(arg1: Kind): Eval = @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "productLEval(arg1)", - "arrow.core.productLEval" + "flatMap { a -> arg1.value().map { a } }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -287,8 +287,8 @@ fun Kind.productLEval(arg1: Eval>): Eval @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "forEffectEval(arg1)", - "arrow.core.forEffectEval" + "flatMap { a -> arg1.value().map { a } }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -307,8 +307,8 @@ fun Kind.forEffectEval(arg1: Eval>): Eval @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "mproduct(arg1)", - "arrow.core.mproduct" + "flatMap { a -> arg1(a).map { Tuple2(a, it) } }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -327,8 +327,8 @@ fun Kind.mproduct(arg1: Function1>): Eval @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "ifM(arg1, arg2)", - "arrow.core.ifM" + "flatMap { if (it) arg1() else arg2() }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -349,8 +349,8 @@ fun Kind.ifM( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "selectM(arg1)", - "arrow.core.selectM" + "flatMap { it.fold({ a -> arg1.map { ff -> ff(a) } }, { b -> just(b) }) }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -369,8 +369,8 @@ fun Kind>.selectM(arg1: Kind arg1.map { ff -> ff(a) } }, { b -> just(b) }) }", + "arrow.core.flatMap" ), DeprecationLevel.WARNING ) @@ -394,4 +394,5 @@ fun Kind>.select(arg1: Kind Date: Fri, 29 Jan 2021 12:20:10 +0100 Subject: [PATCH 13/24] Deprecate eval typeclasses interfaces --- arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt index 8b0ddbd7e..3ac5f0801 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt @@ -15,11 +15,13 @@ import arrow.typeclasses.Monad import arrow.typeclasses.MonadSyntax import arrow.typeclasses.MonadFx +@Deprecated("Functor typeclass is deprecated and will be removed in 0.13.0. Use concrete methods on Eval") interface EvalFunctor : Functor { override fun EvalOf.map(f: (A) -> B): Eval = fix().map(f) } +@Deprecated("Apply typeclass is deprecated and will be removed in 0.13.0. Use concrete methods on Eval") interface EvalApply : Apply { override fun EvalOf.ap(ff: EvalOf<(A) -> B>): Eval = fix().ap(ff) @@ -28,6 +30,7 @@ interface EvalApply : Apply { fix().map(f) } +@Deprecated("Applicative typeclass is deprecated and will be removed in 0.13.0. Use concrete methods on Eval") interface EvalApplicative : Applicative { override fun EvalOf.ap(ff: EvalOf<(A) -> B>): Eval = fix().ap(ff) @@ -39,6 +42,7 @@ interface EvalApplicative : Applicative { Eval.just(a) } +@Deprecated("Monad typeclass is deprecated and will be removed in 0.13.0. Use concrete methods on Eval") interface EvalMonad : Monad { override fun EvalOf.ap(ff: EvalOf<(A) -> B>): Eval = fix().ap(ff) @@ -59,12 +63,14 @@ interface EvalMonad : Monad { get() = EvalFxMonad } +@Deprecated("MonadFx typeclass is deprecated and will be removed in 0.13.0. Use concrete methods on Eval") internal object EvalFxMonad : MonadFx { override val M: Monad = Eval.monad() override fun monad(c: suspend MonadSyntax.() -> A): Eval = super.monad(c).fix() } +@Deprecated("Comonad typeclass is deprecated and will be removed in 0.13.0. Use concrete methods on Eval") interface EvalComonad : Comonad { override fun EvalOf.coflatMap(f: (EvalOf) -> B): Eval = fix().coflatMap(f) @@ -76,6 +82,7 @@ interface EvalComonad : Comonad { fix().map(f) } +@Deprecated("Bimonad typeclass is deprecated and will be removed in 0.13.0. Use concrete methods on Eval") interface EvalBimonad : Bimonad { override fun EvalOf.ap(ff: EvalOf<(A) -> B>): Eval = fix().ap(ff) From a966d3c1ff088b86c6400ccd5bb5dcbf0a8c7812 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 14:45:09 +0100 Subject: [PATCH 14/24] Refactor Endo.combine --- arrow-core-data/src/main/kotlin/arrow/core/Endo.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt b/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt index 8ea31fcda..133a549f7 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Endo.kt @@ -6,11 +6,12 @@ import arrow.typeclasses.Monoid * The monoid of endomorphisms under composition. */ data class Endo(val f: (A) -> A) { + companion object -} -fun Endo.combine(g: Endo): Endo = - Endo(f.compose(g.f)) + fun combine(g: Endo): Endo = + Endo(f.compose(g.f)) +} fun Monoid.Companion.endo(): Monoid> = object : Monoid> { override fun empty(): Endo = From 682001abfa0dacbff1d18c30ad6e306292a1f2b6 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 18:39:57 +0100 Subject: [PATCH 15/24] Remove fix() from new added flatMap function and JvmName-rename some deprecated functions with *Kind --- arrow-core-data/src/main/kotlin/arrow/core/Eval.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 94a9feba2..5dbf2e0e2 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -1,6 +1,5 @@ package arrow.core -import arrow.Kind import arrow.typeclasses.Monoid import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement @@ -74,7 +73,7 @@ sealed class Eval : EvalOf { companion object { - @JvmName("tailRecM_") + @JvmName("tailRecMKind") @Deprecated( "Kind is deprecated, and will be removed in 0.13.0. Please use the tailRecM method defined for Eval instead", ReplaceWith("tailRecM(f)"), @@ -398,7 +397,7 @@ sealed class Eval : EvalOf { fun ap(ff: Eval<(A) -> B>): Eval = ff.flatMap { f -> map(f) } - @JvmName("flatMap_") + @JvmName("flatMapKind") @Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use the flatMap method defined for Eval instead") @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE", "UNCHECKED_CAST") inline fun flatMap(crossinline f: (A) -> EvalOf): Eval = @@ -433,20 +432,20 @@ sealed class Eval : EvalOf { override fun run(s: S): Eval = object : FlatMap() { override fun start(): Eval = (this@Eval).run(s) as Eval - override fun run(s1: S1): Eval = f(s1 as A).fix() + override fun run(s1: S1): Eval = f(s1 as A) } } is Defer -> object : FlatMap() { override fun start(): Eval = this@Eval.thunk() as Eval - override fun run(s: S): Eval = f(s as A).fix() + override fun run(s: S): Eval = f(s as A) } else -> object : FlatMap() { override fun start(): Eval = this@Eval as Eval - override fun run(s: S): Eval = f(s as A).fix() + override fun run(s: S): Eval = f(s as A) } } - @JvmName("coflatMap_") + @JvmName("coflatMapKind") @Deprecated("Kind is deprecated, and will be removed in 0.13.0. Please use the coflatMap method defined for Eval instead") inline fun coflatMap(crossinline f: (EvalOf) -> B): Eval = Later { f(this) } From e3882b7e134878874267653fbbec4274a716e633 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Fri, 29 Jan 2021 19:16:37 +0100 Subject: [PATCH 16/24] Divide and win. Reducing number of flatmapping works.. although build time is increasing --- .../src/main/kotlin/arrow/core/Eval.kt | 173 +++++++++++------- 1 file changed, 104 insertions(+), 69 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 5dbf2e0e2..1217c911b 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -268,7 +268,8 @@ sealed class Eval : EvalOf { b: Eval, crossinline map: (A, B) -> C ): Eval = - mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { b, c, _, _, _, _, _, _, _, _ -> map(b, c) } + mapN(a, b, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _ -> map(aa, bb) } +// a.flatMap { aa -> b.map { bb -> map(aa, bb) } } inline fun mapN( a: Eval, @@ -276,7 +277,8 @@ sealed class Eval : EvalOf { c: Eval, crossinline map: (A, B, C) -> D ): Eval = - mapN(a, b, c, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { b, c, d, _, _, _, _, _, _, _ -> map(b, c, d) } + mapN(a, b, c, Unit, Unit, Unit) { aa, bb, cc, _, _, _ -> map(aa, bb, cc) } +// a.flatMap { aa -> b.flatMap { bb -> c.map { cc -> map(aa, bb, cc) } } } inline fun mapN( a: Eval, @@ -285,8 +287,17 @@ sealed class Eval : EvalOf { d: Eval, crossinline map: (A, B, C, D) -> E ): Eval = - mapN(a, b, c, d, Unit, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, _, _, _, _, _, _ -> map(a, b, c, d) } - + mapN(a, b, c, d, Unit, Unit) { aa, bb, cc, dd, _, _ -> map(aa, bb, cc, dd) } +// a.flatMap { aa -> +// b.flatMap { bb -> +// c.flatMap { cc -> +// d.map { dd -> +// map(aa, bb, cc, dd) +// } +// } +// } +// } +// inline fun mapN( a: Eval, b: Eval, @@ -295,7 +306,18 @@ sealed class Eval : EvalOf { e: Eval, crossinline map: (A, B, C, D, E) -> F ): Eval = - mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { a, b, c, d, e, _, _, _, _, _ -> map(a, b, c, d, e) } + mapN(a, b, c, d, e, Unit) { aa, bb, cc, dd, ee, _ -> map(aa, bb, cc, dd, ee) } +// a.flatMap { aa -> +// b.flatMap { bb -> +// c.flatMap { cc -> +// d.flatMap { dd -> +// e.map { ee -> +// map(aa, bb, cc, dd, ee) +// } +// } +// } +// } +// } inline fun mapN( a: Eval, @@ -306,81 +328,94 @@ sealed class Eval : EvalOf { f: Eval, crossinline map: (A, B, C, D, E, F) -> G ): Eval = - mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { a, b, c, d, e, f, _, _, _, _ -> map(a, b, c, d, e, f) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - crossinline map: (A, B, C, D, E, F, G) -> H - ): Eval = - mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { a, b, c, d, e, f, g, _, _, _ -> map(a, b, c, d, e, f, g) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - crossinline map: (A, B, C, D, E, F, G, H) -> I - ): Eval = - mapN(a, b, c, d, e, f, g, h, Unit, Unit) { a, b, c, d, e, f, g, h, _, _ -> map(a, b, c, d, e, f, g, h) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - i: Eval, - crossinline map: (A, B, C, D, E, F, G, H, I) -> J - ): Eval = - mapN(a, b, c, d, e, f, g, h, i, Unit) { a, b, c, d, e, f, g, h, i, _ -> map(a, b, c, d, e, f, g, h, i) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - i: Eval, - j: Eval, - crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K - ): Eval = a.flatMap { aa -> b.flatMap { bb -> c.flatMap { cc -> d.flatMap { dd -> e.flatMap { ee -> - f.flatMap { ff -> - g.flatMap { gg -> - h.flatMap { hh -> - i.flatMap { ii -> - j.map { jj -> - map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) - } - } - } - } + f.map { ff -> + map(aa, bb, cc, dd, ee, ff) } } } } } } +// mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { a, b, c, d, e, f, _, _, _, _ -> map(a, b, c, d, e, f) } +// +// inline fun mapN( +// a: Eval, +// b: Eval, +// c: Eval, +// d: Eval, +// e: Eval, +// f: Eval, +// g: Eval, +// crossinline map: (A, B, C, D, E, F, G) -> H +// ): Eval = +// mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { a, b, c, d, e, f, g, _, _, _ -> map(a, b, c, d, e, f, g) } +// +// inline fun mapN( +// a: Eval, +// b: Eval, +// c: Eval, +// d: Eval, +// e: Eval, +// f: Eval, +// g: Eval, +// h: Eval, +// crossinline map: (A, B, C, D, E, F, G, H) -> I +// ): Eval = +// mapN(a, b, c, d, e, f, g, h, Unit, Unit) { a, b, c, d, e, f, g, h, _, _ -> map(a, b, c, d, e, f, g, h) } +// +// inline fun mapN( +// a: Eval, +// b: Eval, +// c: Eval, +// d: Eval, +// e: Eval, +// f: Eval, +// g: Eval, +// h: Eval, +// i: Eval, +// crossinline map: (A, B, C, D, E, F, G, H, I) -> J +// ): Eval = +// mapN(a, b, c, d, e, f, g, h, i, Unit) { a, b, c, d, e, f, g, h, i, _ -> map(a, b, c, d, e, f, g, h, i) } +// +// inline fun mapN( +// a: Eval, +// b: Eval, +// c: Eval, +// d: Eval, +// e: Eval, +// f: Eval, +// g: Eval, +// h: Eval, +// i: Eval, +// j: Eval, +// crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K +// ): Eval = +// a.flatMap { aa -> +// b.flatMap { bb -> +// c.flatMap { cc -> +// d.flatMap { dd -> +// e.flatMap { ee -> +// f.flatMap { ff -> +// g.flatMap { gg -> +// h.flatMap { hh -> +// i.flatMap { ii -> +// j.map { jj -> +// map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) +// } +// } +// } +// } +// } +// } +// } +// } +// } +// } } abstract fun value(): A From 0f6b764f19fb86b27bf9e0ce1f22ec22e9810185 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Mon, 1 Feb 2021 09:00:07 +0100 Subject: [PATCH 17/24] Increase Eval.mapN --- .../src/main/kotlin/arrow/core/Eval.kt | 55 ++++++++++++------- build.gradle | 12 +++- 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 1217c911b..8614fee46 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -277,7 +277,7 @@ sealed class Eval : EvalOf { c: Eval, crossinline map: (A, B, C) -> D ): Eval = - mapN(a, b, c, Unit, Unit, Unit) { aa, bb, cc, _, _, _ -> map(aa, bb, cc) } + mapN(a, b, c, Unit, Unit, Unit, Unit) { aa, bb, cc, _, _, _, _ -> map(aa, bb, cc) } // a.flatMap { aa -> b.flatMap { bb -> c.map { cc -> map(aa, bb, cc) } } } inline fun mapN( @@ -287,7 +287,7 @@ sealed class Eval : EvalOf { d: Eval, crossinline map: (A, B, C, D) -> E ): Eval = - mapN(a, b, c, d, Unit, Unit) { aa, bb, cc, dd, _, _ -> map(aa, bb, cc, dd) } + mapN(a, b, c, d, Unit, Unit, Unit) { aa, bb, cc, dd, _, _, _ -> map(aa, bb, cc, dd) } // a.flatMap { aa -> // b.flatMap { bb -> // c.flatMap { cc -> @@ -306,7 +306,7 @@ sealed class Eval : EvalOf { e: Eval, crossinline map: (A, B, C, D, E) -> F ): Eval = - mapN(a, b, c, d, e, Unit) { aa, bb, cc, dd, ee, _ -> map(aa, bb, cc, dd, ee) } + mapN(a, b, c, d, e, Unit, Unit) { aa, bb, cc, dd, ee, _, _ -> map(aa, bb, cc, dd, ee) } // a.flatMap { aa -> // b.flatMap { bb -> // c.flatMap { cc -> @@ -328,32 +328,47 @@ sealed class Eval : EvalOf { f: Eval, crossinline map: (A, B, C, D, E, F) -> G ): Eval = +// a.flatMap { aa -> +// b.flatMap { bb -> +// c.flatMap { cc -> +// d.flatMap { dd -> +// e.flatMap { ee -> +// f.map { ff -> +// map(aa, bb, cc, dd, ee, ff) +// } +// } +// } +// } +// } +// } + mapN(a, b, c, d, e, f, Unit) { aa, bb, cc, dd, ee, ff, _ -> map(aa, bb, cc, dd, ee, ff) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + crossinline map: (A, B, C, D, E, F, G) -> H + ): Eval = a.flatMap { aa -> b.flatMap { bb -> c.flatMap { cc -> d.flatMap { dd -> e.flatMap { ee -> - f.map { ff -> - map(aa, bb, cc, dd, ee, ff) + f.flatMap { ff -> + g.map { gg -> + map(aa, bb, cc, dd, ee, ff, gg) + } } } } } } } -// mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { a, b, c, d, e, f, _, _, _, _ -> map(a, b, c, d, e, f) } -// -// inline fun mapN( -// a: Eval, -// b: Eval, -// c: Eval, -// d: Eval, -// e: Eval, -// f: Eval, -// g: Eval, -// crossinline map: (A, B, C, D, E, F, G) -> H -// ): Eval = -// mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { a, b, c, d, e, f, g, _, _, _ -> map(a, b, c, d, e, f, g) } +// mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, _, _, _ -> map(aa, bb, cc, dd, ee, ff, gg) } // // inline fun mapN( // a: Eval, @@ -366,7 +381,7 @@ sealed class Eval : EvalOf { // h: Eval, // crossinline map: (A, B, C, D, E, F, G, H) -> I // ): Eval = -// mapN(a, b, c, d, e, f, g, h, Unit, Unit) { a, b, c, d, e, f, g, h, _, _ -> map(a, b, c, d, e, f, g, h) } +// mapN(a, b, c, d, e, f, g, h, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } // // inline fun mapN( // a: Eval, @@ -380,7 +395,7 @@ sealed class Eval : EvalOf { // i: Eval, // crossinline map: (A, B, C, D, E, F, G, H, I) -> J // ): Eval = -// mapN(a, b, c, d, e, f, g, h, i, Unit) { a, b, c, d, e, f, g, h, i, _ -> map(a, b, c, d, e, f, g, h, i) } +// mapN(a, b, c, d, e, f, g, h, i, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } // // inline fun mapN( // a: Eval, diff --git a/build.gradle b/build.gradle index 8d4e480e8..bd31e0f42 100644 --- a/build.gradle +++ b/build.gradle @@ -27,14 +27,14 @@ ktlint { // -- Artifacts publication configure(subprojects - - project("arrow-meta:arrow-meta-test-models") + - project("arrow-meta:arrow-meta-test-models") ) { apply from: "$PUBLICATION" } // -- Gradle Animal Sniffer Plugin: https://github.com/xvik/gradle-animalsniffer-plugin configure(subprojects - - project("arrow-meta") + - project("arrow-meta") ) { apply plugin: 'ru.vyarus.animalsniffer' apply plugin: 'java' @@ -48,3 +48,11 @@ configure(subprojects signature 'net.sf.androidscents.signature:android-api-level-21:5.0.1_r2@signature' } } + +//shadowJar { +// zip64 true +//} + +//tasks.shadowJar { +// zip64 = true +//} From b431a41dd6752e8bd414f812e26ef4565849ff00 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Mon, 1 Feb 2021 10:07:55 +0100 Subject: [PATCH 18/24] Enable zip64 --- arrow-core-data/build.gradle | 4 ++++ build.gradle | 8 -------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arrow-core-data/build.gradle b/arrow-core-data/build.gradle index 8530a3f5b..475f1ceac 100644 --- a/arrow-core-data/build.gradle +++ b/arrow-core-data/build.gradle @@ -19,3 +19,7 @@ dependencies { testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$JUNIT_VINTAGE_VERSION" testImplementation project(":arrow-core-test") } + +jar { + zip64 true +} diff --git a/build.gradle b/build.gradle index bd31e0f42..def068639 100644 --- a/build.gradle +++ b/build.gradle @@ -48,11 +48,3 @@ configure(subprojects signature 'net.sf.androidscents.signature:android-api-level-21:5.0.1_r2@signature' } } - -//shadowJar { -// zip64 true -//} - -//tasks.shadowJar { -// zip64 = true -//} From b6f3bc55345eb875f4a4f25ed00dcddc555d2f62 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Mon, 1 Feb 2021 10:13:51 +0100 Subject: [PATCH 19/24] Add all mapN up until 10 --- .../src/main/kotlin/arrow/core/Eval.kt | 162 ++++++------------ 1 file changed, 56 insertions(+), 106 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 8614fee46..297c69cfc 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -268,8 +268,7 @@ sealed class Eval : EvalOf { b: Eval, crossinline map: (A, B) -> C ): Eval = - mapN(a, b, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _ -> map(aa, bb) } -// a.flatMap { aa -> b.map { bb -> map(aa, bb) } } + mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _, _, _, _ -> map(aa, bb) } inline fun mapN( a: Eval, @@ -277,8 +276,7 @@ sealed class Eval : EvalOf { c: Eval, crossinline map: (A, B, C) -> D ): Eval = - mapN(a, b, c, Unit, Unit, Unit, Unit) { aa, bb, cc, _, _, _, _ -> map(aa, bb, cc) } -// a.flatMap { aa -> b.flatMap { bb -> c.map { cc -> map(aa, bb, cc) } } } + mapN(a, b, c, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, _, _, _, _, _, _, _ -> map(aa, bb, cc) } inline fun mapN( a: Eval, @@ -287,17 +285,8 @@ sealed class Eval : EvalOf { d: Eval, crossinline map: (A, B, C, D) -> E ): Eval = - mapN(a, b, c, d, Unit, Unit, Unit) { aa, bb, cc, dd, _, _, _ -> map(aa, bb, cc, dd) } -// a.flatMap { aa -> -// b.flatMap { bb -> -// c.flatMap { cc -> -// d.map { dd -> -// map(aa, bb, cc, dd) -// } -// } -// } -// } -// + mapN(a, b, c, d, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, _, _, _, _, _, _ -> map(aa, bb, cc, dd) } + inline fun mapN( a: Eval, b: Eval, @@ -306,18 +295,7 @@ sealed class Eval : EvalOf { e: Eval, crossinline map: (A, B, C, D, E) -> F ): Eval = - mapN(a, b, c, d, e, Unit, Unit) { aa, bb, cc, dd, ee, _, _ -> map(aa, bb, cc, dd, ee) } -// a.flatMap { aa -> -// b.flatMap { bb -> -// c.flatMap { cc -> -// d.flatMap { dd -> -// e.map { ee -> -// map(aa, bb, cc, dd, ee) -// } -// } -// } -// } -// } + mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, ee, _, _, _, _, _ -> map(aa, bb, cc, dd, ee) } inline fun mapN( a: Eval, @@ -328,20 +306,7 @@ sealed class Eval : EvalOf { f: Eval, crossinline map: (A, B, C, D, E, F) -> G ): Eval = -// a.flatMap { aa -> -// b.flatMap { bb -> -// c.flatMap { cc -> -// d.flatMap { dd -> -// e.flatMap { ee -> -// f.map { ff -> -// map(aa, bb, cc, dd, ee, ff) -// } -// } -// } -// } -// } -// } - mapN(a, b, c, d, e, f, Unit) { aa, bb, cc, dd, ee, ff, _ -> map(aa, bb, cc, dd, ee, ff) } + mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, _, _, _, _ -> map(aa, bb, cc, dd, ee, ff) } inline fun mapN( a: Eval, @@ -353,14 +318,62 @@ sealed class Eval : EvalOf { g: Eval, crossinline map: (A, B, C, D, E, F, G) -> H ): Eval = + mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, _, _, _ -> map(aa, bb, cc, dd, ee, ff, gg) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + crossinline map: (A, B, C, D, E, F, G, H) -> I + ): Eval = + mapN(a, b, c, d, e, f, g, h, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + i: Eval, + crossinline map: (A, B, C, D, E, F, G, H, I) -> J + ): Eval = + mapN(a, b, c, d, e, f, g, h, i, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } + + inline fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + i: Eval, + j: Eval, + crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K + ): Eval = a.flatMap { aa -> b.flatMap { bb -> c.flatMap { cc -> d.flatMap { dd -> e.flatMap { ee -> f.flatMap { ff -> - g.map { gg -> - map(aa, bb, cc, dd, ee, ff, gg) + g.flatMap { gg -> + h.flatMap { hh -> + i.flatMap { ii -> + j.map { jj -> + map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) + } + } + } } } } @@ -368,69 +381,6 @@ sealed class Eval : EvalOf { } } } -// mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, _, _, _ -> map(aa, bb, cc, dd, ee, ff, gg) } -// -// inline fun mapN( -// a: Eval, -// b: Eval, -// c: Eval, -// d: Eval, -// e: Eval, -// f: Eval, -// g: Eval, -// h: Eval, -// crossinline map: (A, B, C, D, E, F, G, H) -> I -// ): Eval = -// mapN(a, b, c, d, e, f, g, h, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } -// -// inline fun mapN( -// a: Eval, -// b: Eval, -// c: Eval, -// d: Eval, -// e: Eval, -// f: Eval, -// g: Eval, -// h: Eval, -// i: Eval, -// crossinline map: (A, B, C, D, E, F, G, H, I) -> J -// ): Eval = -// mapN(a, b, c, d, e, f, g, h, i, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } -// -// inline fun mapN( -// a: Eval, -// b: Eval, -// c: Eval, -// d: Eval, -// e: Eval, -// f: Eval, -// g: Eval, -// h: Eval, -// i: Eval, -// j: Eval, -// crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K -// ): Eval = -// a.flatMap { aa -> -// b.flatMap { bb -> -// c.flatMap { cc -> -// d.flatMap { dd -> -// e.flatMap { ee -> -// f.flatMap { ff -> -// g.flatMap { gg -> -// h.flatMap { hh -> -// i.flatMap { ii -> -// j.map { jj -> -// map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) -// } -// } -// } -// } -// } -// } -// } -// } -// } -// } } abstract fun value(): A From 86f7e8f173708d68c1598e7f03a7d5e68182542f Mon Sep 17 00:00:00 2001 From: danimontoya Date: Mon, 1 Feb 2021 10:21:49 +0100 Subject: [PATCH 20/24] Minor change --- arrow-core-data/src/main/kotlin/arrow/core/Eval.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 297c69cfc..1cd839271 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -268,7 +268,7 @@ sealed class Eval : EvalOf { b: Eval, crossinline map: (A, B) -> C ): Eval = - mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _, _, _, _ -> map(aa, bb) } + mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _, _, _, _, _ -> map(aa, bb) } inline fun mapN( a: Eval, From 282d2700daf504ed8e7a5832a5acb3235d45bd9d Mon Sep 17 00:00:00 2001 From: danimontoya Date: Mon, 1 Feb 2021 11:11:58 +0100 Subject: [PATCH 21/24] Eval.mapN until 7 parameters works --- .../src/main/kotlin/arrow/core/Eval.kt | 142 +++++++++++------- 1 file changed, 87 insertions(+), 55 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 1cd839271..9daef2da8 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -268,7 +268,7 @@ sealed class Eval : EvalOf { b: Eval, crossinline map: (A, B) -> C ): Eval = - mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _, _, _, _, _ -> map(aa, bb) } + mapN(a, b, Unit, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _, _ -> map(aa, bb) } inline fun mapN( a: Eval, @@ -276,7 +276,7 @@ sealed class Eval : EvalOf { c: Eval, crossinline map: (A, B, C) -> D ): Eval = - mapN(a, b, c, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, _, _, _, _, _, _, _ -> map(aa, bb, cc) } + mapN(a, b, c, Unit, Unit, Unit, Unit) { aa, bb, cc, _, _, _, _ -> map(aa, bb, cc) } inline fun mapN( a: Eval, @@ -285,7 +285,7 @@ sealed class Eval : EvalOf { d: Eval, crossinline map: (A, B, C, D) -> E ): Eval = - mapN(a, b, c, d, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, _, _, _, _, _, _ -> map(aa, bb, cc, dd) } + mapN(a, b, c, d, Unit, Unit, Unit) { aa, bb, cc, dd, _, _, _ -> map(aa, bb, cc, dd) } inline fun mapN( a: Eval, @@ -295,7 +295,7 @@ sealed class Eval : EvalOf { e: Eval, crossinline map: (A, B, C, D, E) -> F ): Eval = - mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, ee, _, _, _, _, _ -> map(aa, bb, cc, dd, ee) } + mapN(a, b, c, d, e, Unit, Unit) { aa, bb, cc, dd, ee, _, _ -> map(aa, bb, cc, dd, ee) } inline fun mapN( a: Eval, @@ -306,7 +306,7 @@ sealed class Eval : EvalOf { f: Eval, crossinline map: (A, B, C, D, E, F) -> G ): Eval = - mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, _, _, _, _ -> map(aa, bb, cc, dd, ee, ff) } + mapN(a, b, c, d, e, f, Unit) { aa, bb, cc, dd, ee, ff, _ -> map(aa, bb, cc, dd, ee, ff) } inline fun mapN( a: Eval, @@ -318,62 +318,15 @@ sealed class Eval : EvalOf { g: Eval, crossinline map: (A, B, C, D, E, F, G) -> H ): Eval = - mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, _, _, _ -> map(aa, bb, cc, dd, ee, ff, gg) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - crossinline map: (A, B, C, D, E, F, G, H) -> I - ): Eval = - mapN(a, b, c, d, e, f, g, h, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - i: Eval, - crossinline map: (A, B, C, D, E, F, G, H, I) -> J - ): Eval = - mapN(a, b, c, d, e, f, g, h, i, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } - - inline fun mapN( - a: Eval, - b: Eval, - c: Eval, - d: Eval, - e: Eval, - f: Eval, - g: Eval, - h: Eval, - i: Eval, - j: Eval, - crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K - ): Eval = +// mapN(a, b, c, d, e, f, g, Unit) { aa, bb, cc, dd, ee, ff, gg, _ -> map(aa, bb, cc, dd, ee, ff, gg) } a.flatMap { aa -> b.flatMap { bb -> c.flatMap { cc -> d.flatMap { dd -> e.flatMap { ee -> f.flatMap { ff -> - g.flatMap { gg -> - h.flatMap { hh -> - i.flatMap { ii -> - j.map { jj -> - map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) - } - } - } + g.map { gg -> + map(aa, bb, cc, dd, ee, ff, gg) } } } @@ -381,6 +334,85 @@ sealed class Eval : EvalOf { } } } + +// inline fun mapN( +// a: Eval, +// b: Eval, +// c: Eval, +// d: Eval, +// e: Eval, +// f: Eval, +// g: Eval, +// h: Eval, +// crossinline map: (A, B, C, D, E, F, G, H) -> I +// ): Eval = +// mapN(a, b, c, d, e, f, g, h, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } +// a.flatMap { aa -> +// b.flatMap { bb -> +// c.flatMap { cc -> +// d.flatMap { dd -> +// e.flatMap { ee -> +// f.flatMap { ff -> +// g.flatMap { gg -> +// h.map { hh -> +// map(aa, bb, cc, dd, ee, ff, gg, hh) +// } +// } +// } +// } +// } +// } +// } +// } + +// inline fun mapN( +// a: Eval, +// b: Eval, +// c: Eval, +// d: Eval, +// e: Eval, +// f: Eval, +// g: Eval, +// h: Eval, +// i: Eval, +// crossinline map: (A, B, C, D, E, F, G, H, I) -> J +// ): Eval = +// mapN(a, b, c, d, e, f, g, h, i, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } +// +// inline fun mapN( +// a: Eval, +// b: Eval, +// c: Eval, +// d: Eval, +// e: Eval, +// f: Eval, +// g: Eval, +// h: Eval, +// i: Eval, +// j: Eval, +// crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K +// ): Eval = +// a.flatMap { aa -> +// b.flatMap { bb -> +// c.flatMap { cc -> +// d.flatMap { dd -> +// e.flatMap { ee -> +// f.flatMap { ff -> +// g.flatMap { gg -> +// h.flatMap { hh -> +// i.flatMap { ii -> +// j.map { jj -> +// map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) +// } +// } +// } +// } +// } +// } +// } +// } +// } +// } } abstract fun value(): A From d42c57e98dbf3340dec6d653415cbe6d5b909114 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Tue, 2 Feb 2021 10:31:48 +0100 Subject: [PATCH 22/24] Remove inline-crossinline from mapN and flatMap functions Remove zip64 flag --- arrow-core-data/build.gradle | 4 - .../src/main/kotlin/arrow/core/Eval.kt | 168 +++++++----------- 2 files changed, 68 insertions(+), 104 deletions(-) diff --git a/arrow-core-data/build.gradle b/arrow-core-data/build.gradle index 99d52a609..d3da43172 100644 --- a/arrow-core-data/build.gradle +++ b/arrow-core-data/build.gradle @@ -16,7 +16,3 @@ dependencies { testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$JUNIT_VINTAGE_VERSION" testImplementation project(":arrow-core-test") } - -jar { - zip64 true -} diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index 9daef2da8..bd50eb20e 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -263,52 +263,52 @@ sealed class Eval : EvalOf { return curr.value() as A } - inline fun mapN( + fun mapN( a: Eval, b: Eval, - crossinline map: (A, B) -> C + map: (A, B) -> C ): Eval = - mapN(a, b, Unit, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _, _ -> map(aa, bb) } + mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _, _, _, _ -> map(aa, bb) } - inline fun mapN( + fun mapN( a: Eval, b: Eval, c: Eval, - crossinline map: (A, B, C) -> D + map: (A, B, C) -> D ): Eval = - mapN(a, b, c, Unit, Unit, Unit, Unit) { aa, bb, cc, _, _, _, _ -> map(aa, bb, cc) } + mapN(a, b, c, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, _, _, _, _, _, _, _ -> map(aa, bb, cc) } - inline fun mapN( + fun mapN( a: Eval, b: Eval, c: Eval, d: Eval, - crossinline map: (A, B, C, D) -> E + map: (A, B, C, D) -> E ): Eval = - mapN(a, b, c, d, Unit, Unit, Unit) { aa, bb, cc, dd, _, _, _ -> map(aa, bb, cc, dd) } + mapN(a, b, c, d, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, _, _, _, _, _, _ -> map(aa, bb, cc, dd) } - inline fun mapN( + fun mapN( a: Eval, b: Eval, c: Eval, d: Eval, e: Eval, - crossinline map: (A, B, C, D, E) -> F + map: (A, B, C, D, E) -> F ): Eval = - mapN(a, b, c, d, e, Unit, Unit) { aa, bb, cc, dd, ee, _, _ -> map(aa, bb, cc, dd, ee) } + mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, ee, _, _, _, _, _ -> map(aa, bb, cc, dd, ee) } - inline fun mapN( + fun mapN( a: Eval, b: Eval, c: Eval, d: Eval, e: Eval, f: Eval, - crossinline map: (A, B, C, D, E, F) -> G + map: (A, B, C, D, E, F) -> G ): Eval = - mapN(a, b, c, d, e, f, Unit) { aa, bb, cc, dd, ee, ff, _ -> map(aa, bb, cc, dd, ee, ff) } + mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, _, _, _, _ -> map(aa, bb, cc, dd, ee, ff) } - inline fun mapN( + fun mapN( a: Eval, b: Eval, c: Eval, @@ -316,17 +316,64 @@ sealed class Eval : EvalOf { e: Eval, f: Eval, g: Eval, - crossinline map: (A, B, C, D, E, F, G) -> H + map: (A, B, C, D, E, F, G) -> H ): Eval = -// mapN(a, b, c, d, e, f, g, Unit) { aa, bb, cc, dd, ee, ff, gg, _ -> map(aa, bb, cc, dd, ee, ff, gg) } + mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, _, _, _ -> map(aa, bb, cc, dd, ee, ff, gg) } + + fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + map: (A, B, C, D, E, F, G, H) -> I + ): Eval = + mapN(a, b, c, d, e, f, g, h, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } + + fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + i: Eval, + map: (A, B, C, D, E, F, G, H, I) -> J + ): Eval = + mapN(a, b, c, d, e, f, g, h, i, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } + + fun mapN( + a: Eval, + b: Eval, + c: Eval, + d: Eval, + e: Eval, + f: Eval, + g: Eval, + h: Eval, + i: Eval, + j: Eval, + map: (A, B, C, D, E, F, G, H, I, J) -> K + ): Eval = a.flatMap { aa -> b.flatMap { bb -> c.flatMap { cc -> d.flatMap { dd -> e.flatMap { ee -> f.flatMap { ff -> - g.map { gg -> - map(aa, bb, cc, dd, ee, ff, gg) + g.flatMap { gg -> + h.flatMap { hh -> + i.flatMap { ii -> + j.map { jj -> + map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) + } + } + } } } } @@ -334,85 +381,6 @@ sealed class Eval : EvalOf { } } } - -// inline fun mapN( -// a: Eval, -// b: Eval, -// c: Eval, -// d: Eval, -// e: Eval, -// f: Eval, -// g: Eval, -// h: Eval, -// crossinline map: (A, B, C, D, E, F, G, H) -> I -// ): Eval = -// mapN(a, b, c, d, e, f, g, h, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } -// a.flatMap { aa -> -// b.flatMap { bb -> -// c.flatMap { cc -> -// d.flatMap { dd -> -// e.flatMap { ee -> -// f.flatMap { ff -> -// g.flatMap { gg -> -// h.map { hh -> -// map(aa, bb, cc, dd, ee, ff, gg, hh) -// } -// } -// } -// } -// } -// } -// } -// } - -// inline fun mapN( -// a: Eval, -// b: Eval, -// c: Eval, -// d: Eval, -// e: Eval, -// f: Eval, -// g: Eval, -// h: Eval, -// i: Eval, -// crossinline map: (A, B, C, D, E, F, G, H, I) -> J -// ): Eval = -// mapN(a, b, c, d, e, f, g, h, i, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } -// -// inline fun mapN( -// a: Eval, -// b: Eval, -// c: Eval, -// d: Eval, -// e: Eval, -// f: Eval, -// g: Eval, -// h: Eval, -// i: Eval, -// j: Eval, -// crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K -// ): Eval = -// a.flatMap { aa -> -// b.flatMap { bb -> -// c.flatMap { cc -> -// d.flatMap { dd -> -// e.flatMap { ee -> -// f.flatMap { ff -> -// g.flatMap { gg -> -// h.flatMap { hh -> -// i.flatMap { ii -> -// j.map { jj -> -// map(aa, bb, cc, dd, ee, ff, gg, hh, ii, jj) -// } -// } -// } -// } -// } -// } -// } -// } -// } -// } } abstract fun value(): A @@ -455,7 +423,7 @@ sealed class Eval : EvalOf { } @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE", "UNCHECKED_CAST") - inline fun flatMap(crossinline f: (A) -> Eval): Eval = + fun flatMap(f: (A) -> Eval): Eval = when (this) { is FlatMap -> object : FlatMap() { override fun start(): Eval = (this@Eval).start() From 7643c199406c71b640d98563ed92155e35649f9f Mon Sep 17 00:00:00 2001 From: danimontoya Date: Tue, 2 Feb 2021 12:08:44 +0100 Subject: [PATCH 23/24] Fix deprecation messages and imports from comments --- .../src/main/kotlin/arrow/core/Eval.kt | 10 + .../core/extensions/endo/monoid/EndoMonoid.kt | 5 +- .../eval/applicative/EvalApplicative.kt | 8 +- .../core/extensions/eval/apply/EvalApply.kt | 191 +++++++++++------- .../extensions/eval/comonad/EvalComonad.kt | 5 +- 5 files changed, 139 insertions(+), 80 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index bd50eb20e..fa4c6e4b8 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -95,6 +95,11 @@ sealed class Eval : EvalOf { } } + @Deprecated( + "just is deprecated in favor of now", + ReplaceWith("now(a)"), + DeprecationLevel.WARNING + ) fun just(a: A): Eval = now(a) @@ -453,6 +458,11 @@ sealed class Eval : EvalOf { inline fun coflatMap(crossinline f: (Eval) -> B): Eval = Later { f(this) } + @Deprecated( + "extract is deprecated in favor of value", + ReplaceWith("value()"), + DeprecationLevel.WARNING + ) fun extract(): A = value() /** diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt index 840401ecd..1bfc71940 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/endo/monoid/EndoMonoid.kt @@ -54,6 +54,9 @@ fun combineAll(arg0: List>): Endo = "UNCHECKED_CAST", "NOTHING_TO_INLINE" ) -@Deprecated("Monoid typeclasses is deprecated. Use concrete methods on Endo") +@Deprecated( + "Extension projections are deprecated. Use endo on Monoid.", + ReplaceWith("Monoid.endo()", "arrow.typeclasses.Monoid", "arrow.core.endo") +) inline fun Companion.monoid(): EndoMonoid = monoid_singleton as arrow.core.extensions.EndoMonoid diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt index 71e314382..16f298aaf 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/applicative/EvalApplicative.kt @@ -23,8 +23,8 @@ internal val applicative_singleton: EvalApplicative = object : arrow.core.extens @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "just()", - "arrow.core.just" + "Eval.now(this)", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) @@ -42,8 +42,8 @@ fun A.just(): Eval = arrow.core.Eval.applicative().run { @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "just(Unit)", - "arrow.core.just" + "Eval.Unit", + "arrow.core.Eval" ), DeprecationLevel.WARNING ) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt index d09118307..bbc6003c1 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/apply/EvalApply.kt @@ -93,8 +93,9 @@ fun Kind.map2Eval( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1) { a, b -> arg2(Tuple2(a, b)) }", + "arrow.core.Eval", + "arrow.core.Tuple2" ), DeprecationLevel.WARNING ) @@ -116,8 +117,9 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1) { a, b -> arg2(Tuple2(a, b)) }", + "arrow.core.Eval", + "arrow.core.Tuple2" ), DeprecationLevel.WARNING ) @@ -139,8 +141,9 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2) { a, b, c -> arg3(Tuple3(a, b, c)) }", + "arrow.core.Eval", + "arrow.core.Tuple3" ), DeprecationLevel.WARNING ) @@ -163,8 +166,9 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2) { a, b, c -> arg3(Tuple3(a, b, c)) }", + "arrow.core.Eval", + "arrow.core.Tuple3" ), DeprecationLevel.WARNING ) @@ -187,8 +191,9 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3) { a, b, c, d -> arg4(Tuple4(a, b, c, d)) }", + "arrow.core.Eval", + "arrow.core.Tuple4" ), DeprecationLevel.WARNING ) @@ -212,8 +217,9 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3) { a, b, c, d -> arg4(Tuple4(a, b, c, d)) }", + "arrow.core.Eval", + "arrow.core.Tuple4" ), DeprecationLevel.WARNING ) @@ -237,8 +243,9 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4) { a, b, c, d, e -> arg5(Tuple5(a, b, c, d, e)) }", + "arrow.core.Eval", + "arrow.core.Tuple5" ), DeprecationLevel.WARNING ) @@ -263,8 +270,9 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4) { a, b, c, d, e -> arg5(Tuple5(a, b, c, d, e)) }", + "arrow.core.Eval", + "arrow.core.Tuple5" ), DeprecationLevel.WARNING ) @@ -289,8 +297,9 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5) { a, b, c, d, e, f -> arg6(Tuple6(a, b, c, d, e, f)) }", + "arrow.core.Eval", + "arrow.core.Tuple6" ), DeprecationLevel.WARNING ) @@ -316,8 +325,9 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5) { a, b, c, d, e, f -> arg6(Tuple6(a, b, c, d, e, f)) }", + "arrow.core.Eval", + "arrow.core.Tuple6" ), DeprecationLevel.WARNING ) @@ -343,8 +353,9 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { a, b, c, d, e, f, g -> arg7(Tuple7(a, b, c, d, e, f, g)) }", + "arrow.core.Eval", + "arrow.core.Tuple7" ), DeprecationLevel.WARNING ) @@ -372,8 +383,9 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { a, b, c, d, e, f, g -> arg7(Tuple7(a, b, c, d, e, f, g)) }", + "arrow.core.Eval", + "arrow.core.Tuple7" ), DeprecationLevel.WARNING ) @@ -401,8 +413,9 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { a, b, c, d, e, f, g, h -> arg8(Tuple8(a, b, c, d, e, f, g, h)) }", + "arrow.core.Eval", + "arrow.core.Tuple8" ), DeprecationLevel.WARNING ) @@ -431,8 +444,9 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { a, b, c, d, e, f, g, h -> arg8(Tuple8(a, b, c, d, e, f, g, h)) }", + "arrow.core.Eval", + "arrow.core.Tuple8" ), DeprecationLevel.WARNING ) @@ -461,8 +475,10 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)\n" + + "{ a, b, c, d, e, f, g, h, i -> arg9(Tuple9(a, b, c, d, e, f, g, h, i)) }", + "arrow.core.Eval", + "arrow.core.Tuple9" ), DeprecationLevel.WARNING ) @@ -492,8 +508,10 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)\n" + + "{ a, b, c, d, e, f, g, h, i -> arg9(Tuple9(a, b, c, d, e, f, g, h, i)) }", + "arrow.core.Eval", + "arrow.core.Tuple9" ), DeprecationLevel.WARNING ) @@ -523,8 +541,10 @@ fun mapN( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)\n" + + "{ a, b, c, d, e, f, g, h, i, j -> arg10(Tuple10(a, b, c, d, e, f, g, h, i, j)) }", + "arrow.core.Eval", + "arrow.core.Tuple10" ), DeprecationLevel.WARNING ) @@ -555,8 +575,10 @@ fun map( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)", - "arrow.core.Eval" + "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)\n" + + "{ a, b, c, d, e, f, g, h, i, j -> arg10(Tuple10(a, b, c, d, e, f, g, h, i, j)) }", + "arrow.core.Eval", + "arrow.core.Tuple10" ), DeprecationLevel.WARNING ) @@ -609,7 +631,8 @@ fun Kind.map2(arg1: Kind, arg2: Function1 Tuple2(a, b) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple2" ), DeprecationLevel.WARNING ) @@ -628,8 +651,9 @@ fun Kind.product(arg1: Kind): Eval> @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(this, fb) { (ab, c) -> Tuple3(ab.a, ab.b, c) }", - "arrow.core.Eval" + "Eval.mapN(this, fb) { ab, c -> Tuple3(ab.a, ab.b, c) }", + "arrow.core.Eval", + "arrow.core.Tuple3" ), DeprecationLevel.WARNING ) @@ -648,8 +672,9 @@ fun Kind>.product(arg1: Kind): Eval< @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(this, fb) { (abc, d) -> Tuple4(abc.a, abc.b, abc.c, d) }", - "arrow.core.Eval" + "Eval.mapN(this, fb) { abc, d -> Tuple4(abc.a, abc.b, abc.c, d) }", + "arrow.core.Eval", + "arrow.core.Tuple4" ), DeprecationLevel.WARNING ) @@ -668,8 +693,9 @@ fun Kind>.product(arg1: Kind): @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(this, fb) { (abcd, e) -> Tuple5(abcd.a, abcd.b, abcd.c, abcd.d, e) }", - "arrow.core.Eval" + "Eval.mapN(this, fb) { abcd, e -> Tuple5(abcd.a, abcd.b, abcd.c, abcd.d, e) }", + "arrow.core.Eval", + "arrow.core.Tuple5" ), DeprecationLevel.WARNING ) @@ -689,8 +715,9 @@ fun Kind>.product( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(this, fb) { (abcde, f) -> Tuple6(abcde.a, abcde.b, abcde.c, abcde.d, abcde.e, f) }", - "arrow.core.Eval" + "Eval.mapN(this, fb) { abcde, f -> Tuple6(abcde.a, abcde.b, abcde.c, abcde.d, abcde.e, f) }", + "arrow.core.Eval", + "arrow.core.Tuple6" ), DeprecationLevel.WARNING ) @@ -710,8 +737,9 @@ fun Kind>.product( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(this, fb) { (abcdef, g) -> Tuple7(abcdef.a, abcdef.b, abcdef.c, abcdef.d, abcdef.e, abcdef.f, g) }", - "arrow.core.Eval" + "Eval.mapN(this, fb) { abcdef, g -> Tuple7(abcdef.a, abcdef.b, abcdef.c, abcdef.d, abcdef.e, abcdef.f, g) }", + "arrow.core.Eval", + "arrow.core.Tuple7" ), DeprecationLevel.WARNING ) @@ -731,8 +759,9 @@ fun Kind>.product( @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(this, fb) { (abcdefg, h) -> Tuple8(abcdefg.a, abcdefg.b, abcdefg.c, abcdefg.d, abcdefg.e, abcdefg.f, abcdefg.g, h) }", - "arrow.core.Eval" + "Eval.mapN(this, fb) { abcdefg, h -> Tuple8(abcdefg.a, abcdefg.b, abcdefg.c, abcdefg.d, abcdefg.e, abcdefg.f, abcdefg.g, h) }", + "arrow.core.Eval", + "arrow.core.Tuple8" ), DeprecationLevel.WARNING ) @@ -753,8 +782,9 @@ fun Kind>.produc @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(this, fb) { (abcdefgh, i) -> Tuple9(abcdefgh.a, abcdefgh.b, abcdefgh.c, abcdefgh.d, abcdefgh.e, abcdefgh.f, abcdefgh.g, abcdefgh.h, i) }", - "arrow.core.Eval" + "Eval.mapN(this, fb) { abcdefgh, i -> Tuple9(abcdefgh.a, abcdefgh.b, abcdefgh.c, abcdefgh.d, abcdefgh.e, abcdefgh.f, abcdefgh.g, abcdefgh.h, i) }", + "arrow.core.Eval", + "arrow.core.Tuple9" ), DeprecationLevel.WARNING ) @@ -775,8 +805,9 @@ fun Kind>. @Deprecated( "@extension kinded projected functions are deprecated", ReplaceWith( - "Eval.mapN(this, fb) { (abcdefghi, j) -> Tuple10(abcdefghi.a, abcdefghi.b, abcdefghi.c, abcdefghi.d, abcdefghi.e, abcdefghi.f, abcdefghi.g, abcdefghi.h, abcdefghi.i, j) }", - "arrow.core.Eval" + "Eval.mapN(this, fb) { abcdefghi, j -> Tuple10(abcdefghi.a, abcdefghi.b, abcdefghi.c, abcdefghi.d, abcdefghi.e, abcdefghi.f, abcdefghi.g, abcdefghi.h, abcdefghi.i, j) }", + "arrow.core.Eval", + "arrow.core.Tuple10" ), DeprecationLevel.WARNING ) @@ -799,7 +830,8 @@ fun Kind Tuple2(a, b) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple2" ), DeprecationLevel.WARNING ) @@ -819,7 +851,8 @@ fun tupled(arg0: Kind, arg1: Kind): Eval Tuple2(a, b) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple2" ), DeprecationLevel.WARNING ) @@ -839,7 +872,8 @@ fun tupledN(arg0: Kind, arg1: Kind): Eval Tuple3(a, b, c) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple3" ), DeprecationLevel.WARNING ) @@ -862,7 +896,8 @@ fun tupled( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2) { a, b, c -> Tuple3(a, b, c) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple3" ), DeprecationLevel.WARNING ) @@ -885,7 +920,8 @@ fun tupledN( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3) { a, b, c, d -> Tuple4(a, b, c, d) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple4" ), DeprecationLevel.WARNING ) @@ -909,7 +945,8 @@ fun tupled( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3) { a, b, c, d -> Tuple4(a, b, c, d) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple4" ), DeprecationLevel.WARNING ) @@ -933,7 +970,8 @@ fun tupledN( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4) { a, b, c, d, e -> Tuple5(a, b, c, d, e) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple5" ), DeprecationLevel.WARNING ) @@ -958,7 +996,8 @@ fun tupled( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4) { a, b, c, d, e -> Tuple5(a, b, c, d, e) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple5" ), DeprecationLevel.WARNING ) @@ -983,7 +1022,8 @@ fun tupledN( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5) { a, b, c, d, e, ff -> Tuple6(a, b, c, d, e, ff) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple6" ), DeprecationLevel.WARNING ) @@ -1010,7 +1050,8 @@ fun tupled( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5) { a, b, c, d, e, ff -> Tuple6(a, b, c, d, e, ff) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple6" ), DeprecationLevel.WARNING ) @@ -1037,7 +1078,8 @@ fun tupledN( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { a, b, c, d, e, ff, g -> Tuple7(a, b, c, d, e, ff, g) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple7" ), DeprecationLevel.WARNING ) @@ -1065,7 +1107,8 @@ fun tupled( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { a, b, c, d, e, ff, g -> Tuple7(a, b, c, d, e, ff, g) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple7" ), DeprecationLevel.WARNING ) @@ -1093,7 +1136,8 @@ fun tupledN( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { a, b, c, d, e, ff, g, h -> Tuple8(a, b, c, d, e, ff, g, h) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple8" ), DeprecationLevel.WARNING ) @@ -1122,7 +1166,8 @@ fun tupled( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { a, b, c, d, e, ff, g, h -> Tuple8(a, b, c, d, e, ff, g, h) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple8" ), DeprecationLevel.WARNING ) @@ -1151,7 +1196,8 @@ fun tupledN( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { a, b, c, d, e, ff, g, h, i -> Tuple9(a, b, c, d, e, ff, g, h, i) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple9" ), DeprecationLevel.WARNING ) @@ -1181,7 +1227,8 @@ fun tupled( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { a, b, c, d, e, ff, g, h, i -> Tuple9(a, b, c, d, e, ff, g, h, i) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple9" ), DeprecationLevel.WARNING ) @@ -1211,7 +1258,8 @@ fun tupledN( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { a, b, c, d, e, ff, g, h, i, j -> Tuple10(a, b, c, d, e, ff, g, h, i, j) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple10" ), DeprecationLevel.WARNING ) @@ -1242,7 +1290,8 @@ fun tupled( "@extension kinded projected functions are deprecated", ReplaceWith( "Eval.mapN(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { a, b, c, d, e, ff, g, h, i, j -> Tuple10(a, b, c, d, e, ff, g, h, i, j) }", - "arrow.core.Eval" + "arrow.core.Eval", + "arrow.core.Tuple10" ), DeprecationLevel.WARNING ) diff --git a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt index 7734e0644..09f6c4031 100644 --- a/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt +++ b/arrow-core/src/main/kotlin/arrow/core/extensions/eval/comonad/EvalComonad.kt @@ -41,10 +41,7 @@ fun Kind.coflatMap(arg1: Function1, B>): Eva ) @Deprecated( "@extension kinded projected functions are deprecated", - ReplaceWith( - "extract()", - "arrow.core.extract" - ), + ReplaceWith("value()"), DeprecationLevel.WARNING ) fun Kind.extract(): A = From d949082461ad112bf0bc58157992d0c2c6d263b0 Mon Sep 17 00:00:00 2001 From: danimontoya Date: Wed, 3 Feb 2021 10:29:39 +0100 Subject: [PATCH 24/24] Rename Unit -> unit so its not confused with kotlin.Unit --- .../src/main/kotlin/arrow/core/Eval.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt index fa4c6e4b8..4035c479d 100644 --- a/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt +++ b/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt @@ -172,7 +172,7 @@ sealed class Eval : EvalOf { fun raise(t: Throwable): Eval = defer { throw t } - val Unit: Eval = Now(kotlin.Unit) + val unit: Eval = Now(kotlin.Unit) val True: Eval = Now(true) @@ -273,7 +273,7 @@ sealed class Eval : EvalOf { b: Eval, map: (A, B) -> C ): Eval = - mapN(a, b, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, _, _, _, _, _, _, _ -> map(aa, bb) } + mapN(a, b, unit, unit, unit, unit, unit, unit, unit) { aa, bb, _, _, _, _, _, _, _ -> map(aa, bb) } fun mapN( a: Eval, @@ -281,7 +281,7 @@ sealed class Eval : EvalOf { c: Eval, map: (A, B, C) -> D ): Eval = - mapN(a, b, c, Unit, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, _, _, _, _, _, _, _ -> map(aa, bb, cc) } + mapN(a, b, c, unit, unit, unit, unit, unit, unit, unit) { aa, bb, cc, _, _, _, _, _, _, _ -> map(aa, bb, cc) } fun mapN( a: Eval, @@ -290,7 +290,7 @@ sealed class Eval : EvalOf { d: Eval, map: (A, B, C, D) -> E ): Eval = - mapN(a, b, c, d, Unit, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, _, _, _, _, _, _ -> map(aa, bb, cc, dd) } + mapN(a, b, c, d, unit, unit, unit, unit, unit, unit) { aa, bb, cc, dd, _, _, _, _, _, _ -> map(aa, bb, cc, dd) } fun mapN( a: Eval, @@ -300,7 +300,7 @@ sealed class Eval : EvalOf { e: Eval, map: (A, B, C, D, E) -> F ): Eval = - mapN(a, b, c, d, e, Unit, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, ee, _, _, _, _, _ -> map(aa, bb, cc, dd, ee) } + mapN(a, b, c, d, e, unit, unit, unit, unit, unit) { aa, bb, cc, dd, ee, _, _, _, _, _ -> map(aa, bb, cc, dd, ee) } fun mapN( a: Eval, @@ -311,7 +311,7 @@ sealed class Eval : EvalOf { f: Eval, map: (A, B, C, D, E, F) -> G ): Eval = - mapN(a, b, c, d, e, f, Unit, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, _, _, _, _ -> map(aa, bb, cc, dd, ee, ff) } + mapN(a, b, c, d, e, f, unit, unit, unit, unit) { aa, bb, cc, dd, ee, ff, _, _, _, _ -> map(aa, bb, cc, dd, ee, ff) } fun mapN( a: Eval, @@ -323,7 +323,7 @@ sealed class Eval : EvalOf { g: Eval, map: (A, B, C, D, E, F, G) -> H ): Eval = - mapN(a, b, c, d, e, f, g, Unit, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, _, _, _ -> map(aa, bb, cc, dd, ee, ff, gg) } + mapN(a, b, c, d, e, f, g, unit, unit, unit) { aa, bb, cc, dd, ee, ff, gg, _, _, _ -> map(aa, bb, cc, dd, ee, ff, gg) } fun mapN( a: Eval, @@ -336,7 +336,7 @@ sealed class Eval : EvalOf { h: Eval, map: (A, B, C, D, E, F, G, H) -> I ): Eval = - mapN(a, b, c, d, e, f, g, h, Unit, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } + mapN(a, b, c, d, e, f, g, h, unit, unit) { aa, bb, cc, dd, ee, ff, gg, hh, _, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh) } fun mapN( a: Eval, @@ -350,7 +350,7 @@ sealed class Eval : EvalOf { i: Eval, map: (A, B, C, D, E, F, G, H, I) -> J ): Eval = - mapN(a, b, c, d, e, f, g, h, i, Unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } + mapN(a, b, c, d, e, f, g, h, i, unit) { aa, bb, cc, dd, ee, ff, gg, hh, ii, _ -> map(aa, bb, cc, dd, ee, ff, gg, hh, ii) } fun mapN( a: Eval,