Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix andThen duplication #3020

Merged
merged 4 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions arrow-libs/core/arrow-core/api/arrow-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ public final class arrow/core/ComparisonKt {
public static final fun sort (S[S)Ljava/util/List;
}

public final class arrow/core/Composition {
public static final fun andThen (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function0;
public static final fun andThen (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1;
public static final fun andThen (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function2;
public static final fun compose (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1;
}

public abstract class arrow/core/Either {
public static final field Companion Larrow/core/Either$Companion;
public static final fun catch (Lkotlin/jvm/functions/Function0;)Larrow/core/Either;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import arrow.core.None
import arrow.core.Option
import arrow.core.Either.Right
import arrow.core.Some
import arrow.core.compose
import arrow.core.identity
import kotlin.jvm.JvmStatic

Expand Down Expand Up @@ -120,9 +119,8 @@ public interface PIso<S, T, A, B> : PPrism<S, T, A, B>, PLens<S, T, A, B> {
* Compose a [PIso] with a [PIso]
*/
public infix fun <C, D> compose(other: PIso<in A, out B, out C, in D>): PIso<S, T, C, D> = PIso(
other::get compose this::get,
this::reverseGet compose other::reverseGet
)
{ s -> other.get(get(s)) }
) { d -> reverseGet(other.reverseGet(d)) }

public operator fun <C, D> plus(other: PIso<in A, out B, out C, in D>): PIso<S, T, C, D> =
this compose other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import arrow.core.Either.Right
import arrow.core.None
import arrow.core.Option
import arrow.core.Some
import arrow.core.compose
import arrow.core.flatMap
import arrow.core.identity
import arrow.core.left
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package arrow.optics.test.laws

import arrow.core.compose
import arrow.core.identity
import arrow.optics.Iso
import io.kotest.property.Arb
Expand Down Expand Up @@ -42,7 +41,7 @@ data class IsoLaws<A, B>(

private suspend fun <A, B> Iso<A, B>.composeModify(aGen: Arb<A>, funcGen: Arb<(B) -> B>, eq: (A, A) -> Boolean): PropertyContext =
checkAll(100, aGen, funcGen, funcGen) { a, f, g ->
modify(modify(a, f), g).equalUnderTheLaw(modify(a, g compose f), eq)
modify(modify(a, f), g).equalUnderTheLaw(modify(a) { g(f(it)) }, eq)
}

private suspend fun <A, B> Iso<A, B>.consistentSetModify(aGen: Arb<A>, bGen: Arb<B>, eq: (A, A) -> Boolean): PropertyContext =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package arrow.optics.test.laws

import arrow.core.compose
import arrow.core.identity
import arrow.optics.Lens
import io.kotest.property.Arb
Expand Down Expand Up @@ -67,7 +66,7 @@ data class LensLaws<A, B>(
private suspend fun <A, B> lensComposeModify(lensGen: Arb<Lens<A, B>>, aGen: Arb<A>, funcGen: Arb<(B) -> B>, eq: (A, A) -> Boolean): PropertyContext =
checkAll(100, lensGen, aGen, funcGen, funcGen) { lens, a, f, g ->
lens.run {
modify(modify(a, f), g).equalUnderTheLaw(modify(a, g compose f), eq)
modify(modify(a, f), g).equalUnderTheLaw(modify(a) { g(f(it)) }, eq)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package arrow.optics.test.laws

import arrow.core.compose
import arrow.core.identity
import arrow.optics.Optional
import io.kotest.property.Arb
Expand Down Expand Up @@ -94,7 +93,7 @@ data class OptionalLaws<A, B>(
checkAll(100, optionalGen, aGen, funcGen, funcGen) { optional, a, f, g ->
optional.run {
modify(modify(a, f), g)
.equalUnderTheLaw(modify(a, g compose f), eq)
.equalUnderTheLaw(modify(a) { g(f(it)) }, eq)
}
}

Expand Down
Loading