diff --git a/arrow-libs/core/arrow-core/api/arrow-core.api b/arrow-libs/core/arrow-core/api/arrow-core.api index fc33b4f3d0d..9d6ddfba8c1 100644 --- a/arrow-libs/core/arrow-core/api/arrow-core.api +++ b/arrow-libs/core/arrow-core/api/arrow-core.api @@ -2631,25 +2631,21 @@ public final class arrow/core/continuations/EagerEffectKt { } public abstract interface class arrow/core/continuations/EagerEffectScope { - public abstract fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/continuations/EagerEffect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public abstract fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun shift (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class arrow/core/continuations/EagerEffectScope$DefaultImpls { - public static fun attempt (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EagerEffectScope;Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EagerEffectScope;Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EagerEffectScope;Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EagerEffectScope;Larrow/core/continuations/EagerEffect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EagerEffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun catch (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public static fun ensure (Larrow/core/continuations/EagerEffectScope;ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } @@ -2692,27 +2688,23 @@ public final class arrow/core/continuations/EffectKt { } public abstract interface class arrow/core/continuations/EffectScope { - public abstract fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/continuations/EagerEffect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Larrow/core/continuations/Effect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun bind (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun shift (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class arrow/core/continuations/EffectScope$DefaultImpls { - public static fun attempt (Larrow/core/continuations/EffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EffectScope;Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EffectScope;Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EffectScope;Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EffectScope;Larrow/core/continuations/EagerEffect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EffectScope;Larrow/core/continuations/Effect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun catch (Larrow/core/continuations/EffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun ensure (Larrow/core/continuations/EffectScope;ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } @@ -2728,14 +2720,12 @@ public final class arrow/core/continuations/FoldContinuation : kotlin/coroutines public final class arrow/core/continuations/IorEagerEffectScope : arrow/core/continuations/EagerEffectScope, arrow/typeclasses/Semigroup { public fun (Larrow/typeclasses/Semigroup;Larrow/core/continuations/EagerEffectScope;)V - public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun bind (Larrow/core/Ior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/continuations/EagerEffect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public fun combine (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun getLeftState ()Ljava/util/concurrent/atomic/AtomicReference; @@ -2747,7 +2737,6 @@ public final class arrow/core/continuations/IorEagerEffectScope : arrow/core/con public final class arrow/core/continuations/IorEffectScope : arrow/core/continuations/EffectScope, arrow/typeclasses/Semigroup { public fun (Larrow/typeclasses/Semigroup;Larrow/core/continuations/EffectScope;)V - public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun bind (Larrow/core/Ior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2755,7 +2744,6 @@ public final class arrow/core/continuations/IorEffectScope : arrow/core/continua public fun bind (Larrow/core/continuations/EagerEffect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/continuations/Effect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun combine (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun getLeftState ()Ljava/util/concurrent/atomic/AtomicReference; @@ -2766,8 +2754,6 @@ public final class arrow/core/continuations/IorEffectScope : arrow/core/continua } public final class arrow/core/continuations/NullableEagerEffectScope : arrow/core/continuations/EagerEffectScope { - public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun attempt-impl (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2781,8 +2767,6 @@ public final class arrow/core/continuations/NullableEagerEffectScope : arrow/cor public static final fun bind-impl (Larrow/core/continuations/EagerEffectScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind-impl (Larrow/core/continuations/EagerEffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final synthetic fun box-impl (Larrow/core/continuations/EagerEffectScope;)Larrow/core/continuations/NullableEagerEffectScope; - public fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; - public static fun catch-impl (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public static fun constructor-impl (Larrow/core/continuations/EagerEffectScope;)Larrow/core/continuations/EagerEffectScope; public fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun ensure-impl (Larrow/core/continuations/EagerEffectScope;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2801,8 +2785,6 @@ public final class arrow/core/continuations/NullableEagerEffectScope : arrow/cor } public final class arrow/core/continuations/NullableEffectScope : arrow/core/continuations/EffectScope { - public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun attempt-impl (Larrow/core/continuations/EffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2818,8 +2800,6 @@ public final class arrow/core/continuations/NullableEffectScope : arrow/core/con public static final fun bind-impl (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind-impl (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final synthetic fun box-impl (Larrow/core/continuations/EffectScope;)Larrow/core/continuations/NullableEffectScope; - public fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun catch-impl (Larrow/core/continuations/EffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun constructor-impl (Larrow/core/continuations/EffectScope;)Larrow/core/continuations/EffectScope; public fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun ensure-impl (Larrow/core/continuations/EffectScope;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2843,8 +2823,6 @@ public final class arrow/core/continuations/NullableKt { } public final class arrow/core/continuations/OptionEagerEffectScope : arrow/core/continuations/EagerEffectScope { - public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun attempt-impl (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2857,8 +2835,6 @@ public final class arrow/core/continuations/OptionEagerEffectScope : arrow/core/ public static fun bind-impl (Larrow/core/continuations/EagerEffectScope;Larrow/core/continuations/EagerEffect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind-impl (Larrow/core/continuations/EagerEffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final synthetic fun box-impl (Larrow/core/continuations/EagerEffectScope;)Larrow/core/continuations/OptionEagerEffectScope; - public fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; - public static fun catch-impl (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public static fun constructor-impl (Larrow/core/continuations/EagerEffectScope;)Larrow/core/continuations/EagerEffectScope; public fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun ensure-impl (Larrow/core/continuations/EagerEffectScope;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2877,8 +2853,6 @@ public final class arrow/core/continuations/OptionEagerEffectScope : arrow/core/ } public final class arrow/core/continuations/OptionEffectScope : arrow/core/continuations/EffectScope { - public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun attempt-impl (Larrow/core/continuations/EffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2893,8 +2867,6 @@ public final class arrow/core/continuations/OptionEffectScope : arrow/core/conti public static fun bind-impl (Larrow/core/continuations/EffectScope;Larrow/core/continuations/Effect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind-impl (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final synthetic fun box-impl (Larrow/core/continuations/EffectScope;)Larrow/core/continuations/OptionEffectScope; - public fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun catch-impl (Larrow/core/continuations/EffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun constructor-impl (Larrow/core/continuations/EffectScope;)Larrow/core/continuations/EffectScope; public fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun ensure-impl (Larrow/core/continuations/EffectScope;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2920,8 +2892,6 @@ public final class arrow/core/continuations/OptionKt { } public final class arrow/core/continuations/ResultEagerEffectScope : arrow/core/continuations/EagerEffectScope { - public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun attempt-impl (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2934,8 +2904,6 @@ public final class arrow/core/continuations/ResultEagerEffectScope : arrow/core/ public static final fun bind-impl (Larrow/core/continuations/EagerEffectScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind-impl (Larrow/core/continuations/EagerEffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final synthetic fun box-impl (Larrow/core/continuations/EagerEffectScope;)Larrow/core/continuations/ResultEagerEffectScope; - public fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; - public static fun catch-impl (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public static fun constructor-impl (Larrow/core/continuations/EagerEffectScope;)Larrow/core/continuations/EagerEffectScope; public fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun ensure-impl (Larrow/core/continuations/EagerEffectScope;ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2953,8 +2921,6 @@ public final class arrow/core/continuations/ResultEagerEffectScope : arrow/core/ } public final class arrow/core/continuations/ResultEffectScope : arrow/core/continuations/EffectScope { - public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun attempt-impl (Larrow/core/continuations/EffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Either;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Option;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun bind (Larrow/core/Validated;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -2969,8 +2935,6 @@ public final class arrow/core/continuations/ResultEffectScope : arrow/core/conti public static final fun bind-impl (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun bind-impl (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final synthetic fun box-impl (Larrow/core/continuations/EffectScope;)Larrow/core/continuations/ResultEffectScope; - public fun catch (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun catch-impl (Larrow/core/continuations/EffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun constructor-impl (Larrow/core/continuations/EffectScope;)Larrow/core/continuations/EffectScope; public fun ensure (ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun ensure-impl (Larrow/core/continuations/EffectScope;ZLkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/continuations/EagerEffectScope.kt b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/continuations/EagerEffectScope.kt index 2eedc8bf645..a0be9e206bf 100644 --- a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/continuations/EagerEffectScope.kt +++ b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/continuations/EagerEffectScope.kt @@ -10,8 +10,6 @@ import arrow.core.identity import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract import kotlin.coroutines.RestrictsSuspension -import kotlin.experimental.ExperimentalTypeInference -import kotlin.jvm.JvmInline /** Context of the [EagerEffect] DSL. */ @RestrictsSuspension @@ -188,56 +186,6 @@ public interface EagerEffectScope { */ public suspend fun ensure(condition: Boolean, shift: () -> R): Unit = if (condition) Unit else shift(shift()) - - /** - * Encloses an action for which you want to catch any `shift`. - * [attempt] is used in combination with [catch]. - * - * ``` - * attempt { ... } catch { ... } - * ``` - * - * The [f] may `shift` into a different `EagerEffectScope`, giving - * the chance for a later [catch] to change the shifted value. - * This is useful to simulate re-throwing of exceptions. - */ - @OptIn(ExperimentalTypeInference::class) - public suspend fun attempt( - @BuilderInference - f: suspend EagerEffectScope.() -> A, - ): suspend EagerEffectScope.() -> A = f - - - /** - * When the [EagerEffect] has shifted with [R] it will [recover] - * the shifted value to [A], and when it ran the computation to - * completion it will return the value [A]. - * [catch] is used in combination with [attempt]. - * - * ```kotlin - * import arrow.core.Either - * import arrow.core.None - * import arrow.core.Option - * import arrow.core.Validated - * import arrow.core.continuations.eagerEffect - * import io.kotest.assertions.fail - * import io.kotest.matchers.shouldBe - * - * fun main() { - * eagerEffect { - * val x = Either.Right(1).bind() - * val y = Validated.Valid(2).bind() - * val z = - * attempt { None.bind { "Option was empty" } } catch { 0 } - * x + y + z - * }.fold({ fail("Shift can never be the result") }, { it shouldBe 3 }) - * } - * ``` - * - */ - public infix fun (suspend EagerEffectScope.() -> A).catch( - recover: EagerEffectScope.(E) -> A, - ): A = eagerEffect(this).fold({ recover(it) }, ::identity) } /** @@ -259,11 +207,10 @@ public interface EagerEffectScope { * }.toEither() shouldBe (int?.right() ?: failure.left()) * } * ``` - * + * */ @OptIn(ExperimentalContracts::class) public suspend fun EagerEffectScope.ensureNotNull(value: B?, shift: () -> R): B { contract { returns() implies (value != null) } return value ?: shift(shift()) } - diff --git a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/continuations/EffectScope.kt b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/continuations/EffectScope.kt index b566dbeec8c..60e9332711d 100644 --- a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/continuations/EffectScope.kt +++ b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/continuations/EffectScope.kt @@ -9,8 +9,6 @@ import arrow.core.Validated import arrow.core.identity import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract -import kotlin.experimental.ExperimentalTypeInference -import kotlin.jvm.JvmInline /** Context of the [Effect] DSL. */ public interface EffectScope { @@ -217,55 +215,6 @@ public interface EffectScope { */ public suspend fun ensure(condition: Boolean, shift: () -> R): Unit = if (condition) Unit else shift(shift()) - - /** - * Encloses an action for which you want to catch any `shift`. - * [attempt] is used in combination with [catch]. - * - * ``` - * attempt { ... } catch { ... } - * ``` - * - * The [f] may `shift` into a different `EffectScope`, giving - * the chance for a later [catch] to change the shifted value. - * This is useful to simulate re-throwing of exceptions. - */ - @OptIn(ExperimentalTypeInference::class) - public suspend fun attempt( - @BuilderInference - f: suspend EffectScope.() -> A, - ): suspend EffectScope.() -> A = f - - /** - * When the [Effect] has shifted with [R] it will [recover] - * the shifted value to [A], and when it ran the computation to - * completion it will return the value [A]. - * [catch] is used in combination with [attempt]. - * - * ```kotlin - * import arrow.core.Either - * import arrow.core.None - * import arrow.core.Option - * import arrow.core.Validated - * import arrow.core.continuations.effect - * import io.kotest.assertions.fail - * import io.kotest.matchers.shouldBe - * - * suspend fun main() { - * effect { - * val x = Either.Right(1).bind() - * val y = Validated.Valid(2).bind() - * val z = - * attempt { None.bind { "Option was empty" } } catch { 0 } - * x + y + z - * }.fold({ fail("Shift can never be the result") }, { it shouldBe 3 }) - * } - * ``` - * - */ - public suspend infix fun (suspend EffectScope.() -> A).catch( - recover: suspend EffectScope.(E) -> A, - ): A = effect(this).fold({ recover(it) }, ::identity) } /** @@ -287,11 +236,10 @@ public interface EffectScope { * }.toEither() shouldBe (int?.right() ?: failure.left()) * } * ``` - * + * */ @OptIn(ExperimentalContracts::class) public suspend fun EffectScope.ensureNotNull(value: B?, shift: () -> R): B { contract { returns() implies (value != null) } return value ?: shift(shift()) } - diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/continuations/EagerEffectSpec.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/continuations/EagerEffectSpec.kt index 7c32aeae4c4..040657f0991 100644 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/continuations/EagerEffectSpec.kt +++ b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/continuations/EagerEffectSpec.kt @@ -10,7 +10,6 @@ import io.kotest.matchers.shouldBe import io.kotest.property.Arb import io.kotest.property.arbitrary.boolean import io.kotest.property.arbitrary.int -import io.kotest.property.arbitrary.long import io.kotest.property.arbitrary.orNull import io.kotest.property.arbitrary.string import io.kotest.property.checkAll @@ -58,32 +57,6 @@ class EagerEffectSpec : StringSpec({ } } - "attempt - catch" { - checkAll(Arb.int(), Arb.long()) { i, l -> - eagerEffect { - attempt { - shift(l) - } catch { ll -> - ll shouldBe l - i - } - }.runCont() shouldBe i - } - } - - "attempt - no catch" { - checkAll(Arb.int(), Arb.long()) { i, l -> - eagerEffect { - attempt { - i - } catch { ll -> - ll shouldBe l - i + 1 - } - }.runCont() shouldBe i - } - } - "immediate values" { eagerEffect { 1 }.toEither().orNull() shouldBe 1 } "immediate short-circuit" { eagerEffect { shift("hello") }.runCont() shouldBe "hello" } diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/continuations/EffectSpec.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/continuations/EffectSpec.kt index 7fe46a309a6..4bc582ee6e2 100644 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/continuations/EffectSpec.kt +++ b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/continuations/EffectSpec.kt @@ -10,7 +10,6 @@ import io.kotest.matchers.shouldBe import io.kotest.property.Arb import io.kotest.property.arbitrary.boolean import io.kotest.property.arbitrary.int -import io.kotest.property.arbitrary.long import io.kotest.property.arbitrary.orNull import io.kotest.property.arbitrary.string import io.kotest.property.checkAll @@ -110,32 +109,6 @@ class EffectSpec : } } - "attempt - catch" { - checkAll(Arb.int(), Arb.long()) { i, l -> - effect { - attempt { - shift(l) - } catch { ll -> - ll shouldBe l - i - } - }.runCont() shouldBe i - } - } - - "attempt - no catch" { - checkAll(Arb.int(), Arb.long()) { i, l -> - effect { - attempt { - i - } catch { ll -> - ll shouldBe l - i + 1 - } - }.runCont() shouldBe i - } - } - "eagerEffect can be consumed within an Effect computation" { checkAll(Arb.int(), Arb.int()) { a, b -> val eager: EagerEffect = diff --git a/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-eager-effect-scope-08.kt b/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-eager-effect-scope-08.kt index a68c64d66ca..4f62bcbc504 100644 --- a/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-eager-effect-scope-08.kt +++ b/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-eager-effect-scope-08.kt @@ -1,20 +1,16 @@ // This file was automatically generated from EagerEffectScope.kt by Knit tool. Do not edit. package arrow.core.examples.exampleEagerEffectScope08 -import arrow.core.Either -import arrow.core.None -import arrow.core.Option -import arrow.core.Validated import arrow.core.continuations.eagerEffect -import io.kotest.assertions.fail +import arrow.core.continuations.ensureNotNull +import arrow.core.left +import arrow.core.right import io.kotest.matchers.shouldBe fun main() { + val failure = "failed" + val int: Int? = null eagerEffect { - val x = Either.Right(1).bind() - val y = Validated.Valid(2).bind() - val z = - attempt { None.bind { "Option was empty" } } catch { 0 } - x + y + z - }.fold({ fail("Shift can never be the result") }, { it shouldBe 3 }) + ensureNotNull(int) { failure } + }.toEither() shouldBe (int?.right() ?: failure.left()) } diff --git a/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-eager-effect-scope-09.kt b/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-eager-effect-scope-09.kt deleted file mode 100644 index 9bd00d04b02..00000000000 --- a/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-eager-effect-scope-09.kt +++ /dev/null @@ -1,16 +0,0 @@ -// This file was automatically generated from EagerEffectScope.kt by Knit tool. Do not edit. -package arrow.core.examples.exampleEagerEffectScope09 - -import arrow.core.continuations.eagerEffect -import arrow.core.continuations.ensureNotNull -import arrow.core.left -import arrow.core.right -import io.kotest.matchers.shouldBe - -fun main() { - val failure = "failed" - val int: Int? = null - eagerEffect { - ensureNotNull(int) { failure } - }.toEither() shouldBe (int?.right() ?: failure.left()) -} diff --git a/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-effect-scope-09.kt b/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-effect-scope-09.kt index 4b4ffa3eb7b..dc5178b8589 100644 --- a/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-effect-scope-09.kt +++ b/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-effect-scope-09.kt @@ -1,20 +1,16 @@ // This file was automatically generated from EffectScope.kt by Knit tool. Do not edit. package arrow.core.examples.exampleEffectScope09 -import arrow.core.Either -import arrow.core.None -import arrow.core.Option -import arrow.core.Validated import arrow.core.continuations.effect -import io.kotest.assertions.fail +import arrow.core.continuations.ensureNotNull +import arrow.core.left +import arrow.core.right import io.kotest.matchers.shouldBe suspend fun main() { + val failure = "failed" + val int: Int? = null effect { - val x = Either.Right(1).bind() - val y = Validated.Valid(2).bind() - val z = - attempt { None.bind { "Option was empty" } } catch { 0 } - x + y + z - }.fold({ fail("Shift can never be the result") }, { it shouldBe 3 }) + ensureNotNull(int) { failure } + }.toEither() shouldBe (int?.right() ?: failure.left()) } diff --git a/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-effect-scope-10.kt b/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-effect-scope-10.kt deleted file mode 100644 index 0d0dc84b89e..00000000000 --- a/arrow-libs/core/arrow-core/src/jvmTest/kotlin/examples/example-effect-scope-10.kt +++ /dev/null @@ -1,16 +0,0 @@ -// This file was automatically generated from EffectScope.kt by Knit tool. Do not edit. -package arrow.core.examples.exampleEffectScope10 - -import arrow.core.continuations.effect -import arrow.core.continuations.ensureNotNull -import arrow.core.left -import arrow.core.right -import io.kotest.matchers.shouldBe - -suspend fun main() { - val failure = "failed" - val int: Int? = null - effect { - ensureNotNull(int) { failure } - }.toEither() shouldBe (int?.right() ?: failure.left()) -}