From 833c855e5f66ce7146c14aaa44afd5d2658fc71c Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Thu, 29 Dec 2022 15:50:53 +0100 Subject: [PATCH 1/7] Prisms for Either --- .../commonMain/kotlin/arrow/optics/Prism.kt | 22 ++++++++ .../kotlin/arrow/optics/dsl/either.kt | 55 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt diff --git a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt index 46a0658c564..34adbcc14d5 100644 --- a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt +++ b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt @@ -7,6 +7,8 @@ import arrow.core.Some import arrow.core.compose import arrow.core.flatMap import arrow.core.identity +import arrow.core.left +import arrow.core.right import arrow.typeclasses.Monoid import kotlin.jvm.JvmStatic @@ -172,6 +174,26 @@ public interface PPrism : POptional, PSetter getOrModify = { option -> option.fold({ Either.Right(Unit) }, { Either.Left(option) }) }, reverseGet = { _ -> None } ) + + /** + * [Prism] to focus into an [arrow.core.Either.Left] + */ + @JvmStatic + public fun left(): Prism, L> = + Prism( + getOrModify = { e -> e.fold({ it.right() }, { e.left() }) }, + reverseGet = { it.left() } + ) + + /** + * [Prism] to focus into an [arrow.core.Either.Right] + */ + @JvmStatic + public fun right(): Prism, R> = + Prism( + getOrModify = { e -> e.fold({ e.left() }, { it.right() }) }, + reverseGet = { it.right() } + ) } } diff --git a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt new file mode 100644 index 00000000000..67c7ec0fcfa --- /dev/null +++ b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt @@ -0,0 +1,55 @@ +package arrow.optics.dsl + +import arrow.core.Either +import arrow.optics.Lens +import arrow.optics.Optional +import arrow.optics.Prism +import arrow.optics.Traversal + +/** + * DSL to compose a [Prism] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]> + * + * @receiver [Prism] with a focus in [Either] + * @return [Prism] with a focus in [L] + */ +public inline val Prism>.left: Prism inline get() = this.compose(Prism.left()) + +/** + * DSL to compose a [Optional] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]> + * + * @receiver [Lens] or [Optional] with a focus in [Either] + * @return [Optional] with a focus in [L] + */ +public inline val Optional>.left: Optional inline get() = this.compose(Prism.left()) + +/** + * DSL to compose a [Traversal] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]> + * + * @receiver [Traversal] with a focus in [Either] + * @return [Traversal] with a focus in [L] + */ +public inline val Traversal>.left: Traversal inline get() = this.compose(Prism.left()) + +/** + * DSL to compose a [Prism] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> + * + * @receiver [Prism] with a focus in [Either] + * @return [Prism] with a focus in [R] + */ +public inline val Prism>.right: Prism inline get() = this.compose(Prism.right()) + +/** + * DSL to compose a [Optional] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> + * + * @receiver [Lens] or [Optional] with a focus in [Either] + * @return [Optional] with a focus in [R] + */ +public inline val Optional>.right: Optional inline get() = this.compose(Prism.right()) + +/** + * DSL to compose a [Traversal] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> + * + * @receiver [Traversal] with a focus in [Either] + * @return [Traversal] with a focus in [R] + */ +public inline val Traversal>.right: Traversal inline get() = this.compose(Prism.right()) From 20e97b3d7b45d093cea7e27affa5784e98660284 Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Thu, 29 Dec 2022 16:09:17 +0100 Subject: [PATCH 2/7] Fix conflicting declarations in JVM --- arrow-libs/optics/arrow-optics/api/arrow-optics.api | 13 +++++++++++++ .../src/commonMain/kotlin/arrow/optics/Prism.kt | 4 ++-- .../commonMain/kotlin/arrow/optics/dsl/either.kt | 12 ++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/arrow-libs/optics/arrow-optics/api/arrow-optics.api b/arrow-libs/optics/arrow-optics/api/arrow-optics.api index 970a6993266..f55c1cbc901 100644 --- a/arrow-libs/optics/arrow-optics/api/arrow-optics.api +++ b/arrow-libs/optics/arrow-optics/api/arrow-optics.api @@ -605,6 +605,8 @@ public abstract interface class arrow/optics/PPrism : arrow/optics/PEvery, arrow public abstract fun liftNullable (Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1; public abstract fun modify (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static fun none ()Larrow/optics/PPrism; + public static fun pLeft ()Larrow/optics/PPrism; + public static fun pRight ()Larrow/optics/PPrism; public static fun pSome ()Larrow/optics/PPrism; public abstract fun plus (Larrow/optics/PPrism;)Larrow/optics/PPrism; public abstract fun reverseGet (Ljava/lang/Object;)Ljava/lang/Object; @@ -620,6 +622,8 @@ public final class arrow/optics/PPrism$Companion { public final fun none ()Larrow/optics/PPrism; public final fun only (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Larrow/optics/PPrism; public static synthetic fun only$default (Larrow/optics/PPrism$Companion;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Larrow/optics/PPrism; + public final fun pLeft ()Larrow/optics/PPrism; + public final fun pRight ()Larrow/optics/PPrism; public final fun pSome ()Larrow/optics/PPrism; public final fun some ()Larrow/optics/PPrism; } @@ -813,6 +817,15 @@ public final class arrow/optics/dsl/AtKt { public static final fun at (Larrow/optics/PTraversal;Larrow/optics/typeclasses/At;Ljava/lang/Object;)Larrow/optics/PTraversal; } +public final class arrow/optics/dsl/EitherKt { + public static final fun getLeft (Larrow/optics/POptional;)Larrow/optics/POptional; + public static final fun getLeft (Larrow/optics/PPrism;)Larrow/optics/PPrism; + public static final fun getLeft (Larrow/optics/PTraversal;)Larrow/optics/PTraversal; + public static final fun getRight (Larrow/optics/POptional;)Larrow/optics/POptional; + public static final fun getRight (Larrow/optics/PPrism;)Larrow/optics/PPrism; + public static final fun getRight (Larrow/optics/PTraversal;)Larrow/optics/PTraversal; +} + public final class arrow/optics/dsl/EveryKt { public static final fun every (Larrow/optics/Fold;Larrow/optics/PEvery;)Larrow/optics/Fold; public static final fun every (Larrow/optics/PIso;Larrow/optics/PEvery;)Larrow/optics/PEvery; diff --git a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt index 34adbcc14d5..78f6c37fae7 100644 --- a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt +++ b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt @@ -179,7 +179,7 @@ public interface PPrism : POptional, PSetter * [Prism] to focus into an [arrow.core.Either.Left] */ @JvmStatic - public fun left(): Prism, L> = + public fun pLeft(): Prism, L> = Prism( getOrModify = { e -> e.fold({ it.right() }, { e.left() }) }, reverseGet = { it.left() } @@ -189,7 +189,7 @@ public interface PPrism : POptional, PSetter * [Prism] to focus into an [arrow.core.Either.Right] */ @JvmStatic - public fun right(): Prism, R> = + public fun pRight(): Prism, R> = Prism( getOrModify = { e -> e.fold({ e.left() }, { it.right() }) }, reverseGet = { it.right() } diff --git a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt index 67c7ec0fcfa..3ed05b3330b 100644 --- a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt +++ b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt @@ -12,7 +12,7 @@ import arrow.optics.Traversal * @receiver [Prism] with a focus in [Either] * @return [Prism] with a focus in [L] */ -public inline val Prism>.left: Prism inline get() = this.compose(Prism.left()) +public inline val Prism>.left: Prism inline get() = this.compose(Prism.pLeft()) /** * DSL to compose a [Optional] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]> @@ -20,7 +20,7 @@ public inline val Prism>.left: Prism inline get( * @receiver [Lens] or [Optional] with a focus in [Either] * @return [Optional] with a focus in [L] */ -public inline val Optional>.left: Optional inline get() = this.compose(Prism.left()) +public inline val Optional>.left: Optional inline get() = this.compose(Prism.pLeft()) /** * DSL to compose a [Traversal] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]> @@ -28,7 +28,7 @@ public inline val Optional>.left: Optional inlin * @receiver [Traversal] with a focus in [Either] * @return [Traversal] with a focus in [L] */ -public inline val Traversal>.left: Traversal inline get() = this.compose(Prism.left()) +public inline val Traversal>.left: Traversal inline get() = this.compose(Prism.pLeft()) /** * DSL to compose a [Prism] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> @@ -36,7 +36,7 @@ public inline val Traversal>.left: Traversal inl * @receiver [Prism] with a focus in [Either] * @return [Prism] with a focus in [R] */ -public inline val Prism>.right: Prism inline get() = this.compose(Prism.right()) +public inline val Prism>.right: Prism inline get() = this.compose(Prism.pRight()) /** * DSL to compose a [Optional] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> @@ -44,7 +44,7 @@ public inline val Prism>.right: Prism inline get * @receiver [Lens] or [Optional] with a focus in [Either] * @return [Optional] with a focus in [R] */ -public inline val Optional>.right: Optional inline get() = this.compose(Prism.right()) +public inline val Optional>.right: Optional inline get() = this.compose(Prism.pRight()) /** * DSL to compose a [Traversal] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> @@ -52,4 +52,4 @@ public inline val Optional>.right: Optional inli * @receiver [Traversal] with a focus in [Either] * @return [Traversal] with a focus in [R] */ -public inline val Traversal>.right: Traversal inline get() = this.compose(Prism.right()) +public inline val Traversal>.right: Traversal inline get() = this.compose(Prism.pRight()) From be168fbdede23ea109918a4588b298bf32efb4de Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Sat, 7 Jan 2023 21:10:37 +0100 Subject: [PATCH 3/7] Use better names for prisms --- .../src/commonMain/kotlin/arrow/optics/Prism.kt | 9 +++++---- .../commonMain/kotlin/arrow/optics/dsl/either.kt | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt index 78f6c37fae7..c6fa1ad108a 100644 --- a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt +++ b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt @@ -10,6 +10,7 @@ import arrow.core.identity import arrow.core.left import arrow.core.right import arrow.typeclasses.Monoid +import kotlin.jvm.JvmName import kotlin.jvm.JvmStatic /** @@ -178,8 +179,8 @@ public interface PPrism : POptional, PSetter /** * [Prism] to focus into an [arrow.core.Either.Left] */ - @JvmStatic - public fun pLeft(): Prism, L> = + @JvmStatic @JvmName("eitherLeft") + public fun left(): Prism, L> = Prism( getOrModify = { e -> e.fold({ it.right() }, { e.left() }) }, reverseGet = { it.left() } @@ -188,8 +189,8 @@ public interface PPrism : POptional, PSetter /** * [Prism] to focus into an [arrow.core.Either.Right] */ - @JvmStatic - public fun pRight(): Prism, R> = + @JvmStatic @JvmName("eitherRight") + public fun right(): Prism, R> = Prism( getOrModify = { e -> e.fold({ e.left() }, { it.right() }) }, reverseGet = { it.right() } diff --git a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt index 3ed05b3330b..c39f046ec95 100644 --- a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt +++ b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/dsl/either.kt @@ -3,6 +3,7 @@ package arrow.optics.dsl import arrow.core.Either import arrow.optics.Lens import arrow.optics.Optional +import arrow.optics.PPrism import arrow.optics.Prism import arrow.optics.Traversal @@ -12,7 +13,7 @@ import arrow.optics.Traversal * @receiver [Prism] with a focus in [Either] * @return [Prism] with a focus in [L] */ -public inline val Prism>.left: Prism inline get() = this.compose(Prism.pLeft()) +public inline val Prism>.left: Prism inline get() = this.compose(PPrism.left()) /** * DSL to compose a [Optional] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]> @@ -20,7 +21,7 @@ public inline val Prism>.left: Prism inline get( * @receiver [Lens] or [Optional] with a focus in [Either] * @return [Optional] with a focus in [L] */ -public inline val Optional>.left: Optional inline get() = this.compose(Prism.pLeft()) +public inline val Optional>.left: Optional inline get() = this.compose(PPrism.left()) /** * DSL to compose a [Traversal] with focus [Either] with a [Prism] with a focus of [Either.Left]<[L]> @@ -28,7 +29,7 @@ public inline val Optional>.left: Optional inlin * @receiver [Traversal] with a focus in [Either] * @return [Traversal] with a focus in [L] */ -public inline val Traversal>.left: Traversal inline get() = this.compose(Prism.pLeft()) +public inline val Traversal>.left: Traversal inline get() = this.compose(PPrism.left()) /** * DSL to compose a [Prism] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> @@ -36,7 +37,7 @@ public inline val Traversal>.left: Traversal inl * @receiver [Prism] with a focus in [Either] * @return [Prism] with a focus in [R] */ -public inline val Prism>.right: Prism inline get() = this.compose(Prism.pRight()) +public inline val Prism>.right: Prism inline get() = this.compose(PPrism.right()) /** * DSL to compose a [Optional] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> @@ -44,7 +45,7 @@ public inline val Prism>.right: Prism inline get * @receiver [Lens] or [Optional] with a focus in [Either] * @return [Optional] with a focus in [R] */ -public inline val Optional>.right: Optional inline get() = this.compose(Prism.pRight()) +public inline val Optional>.right: Optional inline get() = this.compose(PPrism.right()) /** * DSL to compose a [Traversal] with focus [Either] with a [Prism] with a focus of [Either.Right]<[R]> @@ -52,4 +53,4 @@ public inline val Optional>.right: Optional inli * @receiver [Traversal] with a focus in [Either] * @return [Traversal] with a focus in [R] */ -public inline val Traversal>.right: Traversal inline get() = this.compose(Prism.pRight()) +public inline val Traversal>.right: Traversal inline get() = this.compose(PPrism.right()) From d3d326227d8a16e2e92baaa781f2e6518ba412da Mon Sep 17 00:00:00 2001 From: serras Date: Sat, 7 Jan 2023 20:14:35 +0000 Subject: [PATCH 4/7] Update API files --- arrow-libs/optics/arrow-optics/api/arrow-optics.api | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arrow-libs/optics/arrow-optics/api/arrow-optics.api b/arrow-libs/optics/arrow-optics/api/arrow-optics.api index f55c1cbc901..47840c64f43 100644 --- a/arrow-libs/optics/arrow-optics/api/arrow-optics.api +++ b/arrow-libs/optics/arrow-optics/api/arrow-optics.api @@ -598,6 +598,8 @@ public final class arrow/optics/POptionalGetter$DefaultImpls { public abstract interface class arrow/optics/PPrism : arrow/optics/PEvery, arrow/optics/POptional, arrow/optics/POptionalGetter, arrow/optics/PSetter, arrow/optics/PTraversal { public static final field Companion Larrow/optics/PPrism$Companion; public abstract fun compose (Larrow/optics/PPrism;)Larrow/optics/PPrism; + public static fun eitherLeft ()Larrow/optics/PPrism; + public static fun eitherRight ()Larrow/optics/PPrism; public abstract fun first ()Larrow/optics/PPrism; public abstract fun foldMap (Larrow/typeclasses/Monoid;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public abstract fun getOrModify (Ljava/lang/Object;)Larrow/core/Either; @@ -605,8 +607,6 @@ public abstract interface class arrow/optics/PPrism : arrow/optics/PEvery, arrow public abstract fun liftNullable (Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1; public abstract fun modify (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static fun none ()Larrow/optics/PPrism; - public static fun pLeft ()Larrow/optics/PPrism; - public static fun pRight ()Larrow/optics/PPrism; public static fun pSome ()Larrow/optics/PPrism; public abstract fun plus (Larrow/optics/PPrism;)Larrow/optics/PPrism; public abstract fun reverseGet (Ljava/lang/Object;)Ljava/lang/Object; @@ -617,13 +617,13 @@ public abstract interface class arrow/optics/PPrism : arrow/optics/PEvery, arrow } public final class arrow/optics/PPrism$Companion { + public final fun eitherLeft ()Larrow/optics/PPrism; + public final fun eitherRight ()Larrow/optics/PPrism; public final fun id ()Larrow/optics/PIso; public final fun invoke (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Larrow/optics/PPrism; public final fun none ()Larrow/optics/PPrism; public final fun only (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Larrow/optics/PPrism; public static synthetic fun only$default (Larrow/optics/PPrism$Companion;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Larrow/optics/PPrism; - public final fun pLeft ()Larrow/optics/PPrism; - public final fun pRight ()Larrow/optics/PPrism; public final fun pSome ()Larrow/optics/PPrism; public final fun some ()Larrow/optics/PPrism; } From faf3d5b41da5412df2e3a45081e4809c89c8aea8 Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Sun, 8 Jan 2023 13:02:15 +0100 Subject: [PATCH 5/7] Update arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt Co-authored-by: Simon Vergauwen --- .../commonMain/kotlin/arrow/optics/Prism.kt | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt index c6fa1ad108a..5eb56c97651 100644 --- a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt +++ b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt @@ -179,20 +179,42 @@ public interface PPrism : POptional, PSetter /** * [Prism] to focus into an [arrow.core.Either.Left] */ - @JvmStatic @JvmName("eitherLeft") - public fun left(): Prism, L> = + @JvmStatic + public fun left(): Prism, L> = pLeft() + + /** + * [Prism] to focus into an [arrow.core.Either.Right] + */ + @JvmStatic + public fun right(): Prism, R> = pRight() + + /** + * [Prism] to focus into an [arrow.core.Either.Left] + */ + @JvmStatic + public fun pLeft(): PPrism, Either, L, E> = Prism( - getOrModify = { e -> e.fold({ it.right() }, { e.left() }) }, + getOrModify = { e -> + when (e) { + is Either.Left -> e.value.right() + is Either.Right -> e.left() + } + }, reverseGet = { it.left() } ) /** * [Prism] to focus into an [arrow.core.Either.Right] */ - @JvmStatic @JvmName("eitherRight") - public fun right(): Prism, R> = - Prism( - getOrModify = { e -> e.fold({ e.left() }, { it.right() }) }, + @JvmStatic + public fun pRight(): PPrism, Either, R, B> = + PPrism( + getOrModify = { e -> + when (e) { + is Either.Left -> e.left() + is Either.Right -> e.value.right() + } + }, reverseGet = { it.right() } ) } From 90dc268170ca29734cec5d1682ff7128d1206e88 Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Sun, 8 Jan 2023 13:18:26 +0100 Subject: [PATCH 6/7] Add JvmName to left and right --- .../src/commonMain/kotlin/arrow/optics/Prism.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt index 5eb56c97651..bd01e0eb1a1 100644 --- a/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt +++ b/arrow-libs/optics/arrow-optics/src/commonMain/kotlin/arrow/optics/Prism.kt @@ -179,17 +179,17 @@ public interface PPrism : POptional, PSetter /** * [Prism] to focus into an [arrow.core.Either.Left] */ - @JvmStatic + @JvmStatic @JvmName("eitherLeft") public fun left(): Prism, L> = pLeft() /** * [Prism] to focus into an [arrow.core.Either.Right] */ - @JvmStatic + @JvmStatic @JvmName("eitherRight") public fun right(): Prism, R> = pRight() /** - * [Prism] to focus into an [arrow.core.Either.Left] + * Polymorphic [PPrism] to focus into an [arrow.core.Either.Left] */ @JvmStatic public fun pLeft(): PPrism, Either, L, E> = @@ -204,7 +204,7 @@ public interface PPrism : POptional, PSetter ) /** - * [Prism] to focus into an [arrow.core.Either.Right] + * Polymorphic [PPrism] to focus into an [arrow.core.Either.Right] */ @JvmStatic public fun pRight(): PPrism, Either, R, B> = From ccf99ebcdbe411410d91a45ac154a5930a800408 Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 8 Jan 2023 12:22:16 +0000 Subject: [PATCH 7/7] Update API files --- arrow-libs/optics/arrow-optics/api/arrow-optics.api | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arrow-libs/optics/arrow-optics/api/arrow-optics.api b/arrow-libs/optics/arrow-optics/api/arrow-optics.api index 47840c64f43..03e6edcdde2 100644 --- a/arrow-libs/optics/arrow-optics/api/arrow-optics.api +++ b/arrow-libs/optics/arrow-optics/api/arrow-optics.api @@ -607,6 +607,8 @@ public abstract interface class arrow/optics/PPrism : arrow/optics/PEvery, arrow public abstract fun liftNullable (Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1; public abstract fun modify (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static fun none ()Larrow/optics/PPrism; + public static fun pLeft ()Larrow/optics/PPrism; + public static fun pRight ()Larrow/optics/PPrism; public static fun pSome ()Larrow/optics/PPrism; public abstract fun plus (Larrow/optics/PPrism;)Larrow/optics/PPrism; public abstract fun reverseGet (Ljava/lang/Object;)Ljava/lang/Object; @@ -624,6 +626,8 @@ public final class arrow/optics/PPrism$Companion { public final fun none ()Larrow/optics/PPrism; public final fun only (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Larrow/optics/PPrism; public static synthetic fun only$default (Larrow/optics/PPrism$Companion;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Larrow/optics/PPrism; + public final fun pLeft ()Larrow/optics/PPrism; + public final fun pRight ()Larrow/optics/PPrism; public final fun pSome ()Larrow/optics/PPrism; public final fun some ()Larrow/optics/PPrism; }