diff --git a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Const.kt b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Const.kt
index 4c99a5bfdac..79cf889db76 100644
--- a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Const.kt
+++ b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Const.kt
@@ -5,9 +5,6 @@ import arrow.higherkind
import arrow.typeclasses.Applicative
import arrow.typeclasses.Semigroup
import arrow.typeclasses.Show
-import arrow.typeclasses.suspended.BindSyntax
-import kotlin.coroutines.Continuation
-import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
fun ConstOf.value(): A = this.fix().value()
@@ -52,36 +49,3 @@ fun ConstOf>.sequence(GA: Applicative): Kind A.const(): Const =
Const(this)
-
-fun const(c: suspend EagerBind>.() -> A): Const {
- val continuation: ConstContinuation = ConstContinuation()
- return continuation.startCoroutineUninterceptedAndReturn {
- Const.just(c())
- } as Const
-}
-
-suspend fun const(c: suspend BindSyntax>.() -> A): Const =
- suspendCoroutineUninterceptedOrReturn { cont ->
- val continuation = ConstSContinuation(cont as Continuation>)
- continuation.startCoroutineUninterceptedOrReturn {
- Const.just(c())
- }
- }
-
-internal class ConstSContinuation(
- parent: Continuation>
-) : SuspendMonadContinuation, T>(parent) {
- override fun ShortCircuit.recover(): Const =
- throw this
-
- override suspend fun Kind, B>.bind(): B =
- value() as B
-}
-
-internal class ConstContinuation : MonadContinuation, T>() {
- override fun ShortCircuit.recover(): Const =
- throw this
-
- override suspend fun Kind, B>.bind(): B =
- value() as B
-}
diff --git a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Either.kt b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Either.kt
index 7431eee94c2..494ff4c2927 100644
--- a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Either.kt
+++ b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Either.kt
@@ -5,9 +5,6 @@ import arrow.core.Either.Left
import arrow.core.Either.Right
import arrow.higherkind
import arrow.typeclasses.Show
-import arrow.typeclasses.suspended.BindSyntax
-import kotlin.coroutines.Continuation
-import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
/**
*
@@ -646,7 +643,7 @@ import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
*
* ```kotlin:ank:playground
* import arrow.core.Either
- * import arrow.core.either
+ * import arrow.core.computations.either
*
* suspend fun main() {
* val value =
@@ -673,7 +670,6 @@ import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
* ```
*
*/
-
@higherkind
sealed class Either : EitherOf {
@@ -1081,8 +1077,6 @@ inline fun B?.rightIfNotNull(default: () -> A): Either = when (this
/**
* Returns [Either.Right] if the value of type Any? is null, otherwise the specified A value wrapped into an
* [Either.Left].
- *
- * ```
*/
inline fun Any?.rightIfNull(default: () -> A): Either = when (this) {
null -> Either.right(null)
@@ -1100,36 +1094,3 @@ inline fun EitherOf.handleErrorWith(f: (A) -> EitherOf): Eith
is Right -> it
}
}
-
-fun either(c: suspend EagerBind>.() -> A): Either {
- val continuation: EitherContinuation = EitherContinuation()
- return continuation.startCoroutineUninterceptedAndReturn {
- Right(c())
- } as Either
-}
-
-suspend fun either(c: suspend BindSyntax>.() -> A): Either =
- suspendCoroutineUninterceptedOrReturn { cont ->
- val continuation = EitherSContinuation(cont as Continuation>)
- continuation.startCoroutineUninterceptedOrReturn {
- Right(c())
- }
- }
-
-internal class EitherSContinuation(
- parent: Continuation>
-) : SuspendMonadContinuation, A>(parent) {
- override fun ShortCircuit.recover(): Kind, A> =
- Left(value as E)
-
- override suspend fun Kind, A>.bind(): A =
- fix().fold({ e -> throw ShortCircuit(e) }, ::identity)
-}
-
-internal class EitherContinuation : MonadContinuation, A>() {
- override fun ShortCircuit.recover(): Kind, A> =
- Left(value as E)
-
- override suspend fun Kind, A>.bind(): A =
- fix().fold({ e -> throw ShortCircuit(e) }, ::identity)
-}
diff --git a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt
index c2dac886c9e..e9b98b54d5a 100644
--- a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt
+++ b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Eval.kt
@@ -1,10 +1,6 @@
package arrow.core
-import arrow.Kind
import arrow.higherkind
-import arrow.typeclasses.suspended.BindSyntax
-import kotlin.coroutines.Continuation
-import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
fun EvalOf.value(): A = this.fix().value()
@@ -367,36 +363,3 @@ fun Iterator.iterateRight(lb: Eval, f: (A, Eval) -> Eval): Ev
Eval.defer { if (this.hasNext()) f(this.next(), loop()) else lb }
return loop()
}
-
-fun eval(c: suspend EagerBind.() -> A): Eval {
- val continuation: EvalContinuation = EvalContinuation()
- return continuation.startCoroutineUninterceptedAndReturn {
- Eval.just(c())
- } as Eval
-}
-
-suspend fun eval(c: suspend BindSyntax.() -> A): Eval =
- suspendCoroutineUninterceptedOrReturn { cont ->
- val continuation = EvalSContinuation(cont as Continuation>)
- continuation.startCoroutineUninterceptedOrReturn {
- Eval.just(c())
- }
- }
-
-internal class EvalSContinuation(
- parent: Continuation>
-) : SuspendMonadContinuation(parent) {
- override fun ShortCircuit.recover(): Kind =
- throw this
-
- override suspend fun Kind.bind(): A =
- fix().value()
-}
-
-internal class EvalContinuation : MonadContinuation() {
- override fun ShortCircuit.recover(): Kind =
- throw this
-
- override suspend fun Kind.bind(): A =
- fix().value()
-}
diff --git a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Validated.kt b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Validated.kt
index 58ffd9c46b4..352333c97ea 100644
--- a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Validated.kt
+++ b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/Validated.kt
@@ -5,9 +5,6 @@ import arrow.higherkind
import arrow.typeclasses.Applicative
import arrow.typeclasses.Semigroup
import arrow.typeclasses.Show
-import arrow.typeclasses.suspended.BindSyntax
-import kotlin.coroutines.Continuation
-import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
typealias ValidatedNel = Validated, A>
typealias Valid = Validated.Valid
@@ -142,7 +139,7 @@ typealias Invalid = Validated.Invalid
* import arrow.core.Option
* import arrow.core.Some
* import arrow.core.Validated
- * import arrow.core.validated
+ * import arrow.core.computations.validated
* import arrow.core.valid
* import arrow.core.invalid
*
@@ -244,7 +241,7 @@ typealias Invalid = Validated.Invalid
* import arrow.core.Option
* import arrow.core.Some
* import arrow.core.Validated
- * import arrow.core.validated
+ * import arrow.core.computations.validated
* import arrow.core.valid
* import arrow.core.invalid
* import arrow.core.NonEmptyList
@@ -311,7 +308,7 @@ typealias Invalid = Validated.Invalid
* import arrow.core.Option
* import arrow.core.Some
* import arrow.core.Validated
- * import arrow.core.validated
+ * import arrow.core.computations.validated
* import arrow.core.valid
* import arrow.core.invalid
* import arrow.core.NonEmptyList
@@ -385,7 +382,7 @@ typealias Invalid = Validated.Invalid
* import arrow.core.right
* import arrow.core.Some
* import arrow.core.Validated
- * import arrow.core.validated
+ * import arrow.core.computations.validated
* import arrow.core.valid
* import arrow.core.invalid
*
@@ -914,36 +911,3 @@ inline fun A.validNel(): ValidatedNel =
inline fun E.invalidNel(): ValidatedNel =
Validated.invalidNel(this)
-
-fun validated(c: suspend EagerBind>.() -> A): Validated {
- val continuation: ValidatedContinuation = ValidatedContinuation()
- return continuation.startCoroutineUninterceptedAndReturn {
- Valid(c())
- } as Validated
-}
-
-suspend fun validated(c: suspend BindSyntax>.() -> A): Validated =
- suspendCoroutineUninterceptedOrReturn { cont ->
- val continuation = ValidatedSContinuation(cont as Continuation>)
- continuation.startCoroutineUninterceptedOrReturn {
- Valid(c())
- }
- }
-
-internal class ValidatedSContinuation(
- parent: Continuation>
-) : SuspendMonadContinuation, A>(parent) {
- override suspend fun Kind, A>.bind(): A =
- fix().fold({ e -> throw ShortCircuit(e) }, ::identity)
-
- override fun ShortCircuit.recover(): Kind, A> =
- Invalid(value as E)
-}
-
-internal class ValidatedContinuation : MonadContinuation, A>() {
- override suspend fun Kind, A>.bind(): A =
- fix().fold({ e -> throw ShortCircuit(e) }, ::identity)
-
- override fun ShortCircuit.recover(): Kind, A> =
- Invalid(value as E)
-}
diff --git a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/const.kt b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/const.kt
new file mode 100644
index 00000000000..afaad2ad789
--- /dev/null
+++ b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/const.kt
@@ -0,0 +1,49 @@
+package arrow.core.computations
+
+import arrow.Kind
+import arrow.core.Const
+import arrow.core.ConstOf
+import arrow.core.ConstPartialOf
+import arrow.core.EagerBind
+import arrow.core.MonadContinuation
+import arrow.core.ShortCircuit
+import arrow.core.SuspendMonadContinuation
+import arrow.core.value
+import arrow.typeclasses.suspended.BindSyntax
+import kotlin.coroutines.Continuation
+import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
+
+object const {
+ fun eager(c: suspend EagerBind>.() -> A): Const {
+ val continuation: ConstContinuation = ConstContinuation()
+ return continuation.startCoroutineUninterceptedAndReturn {
+ Const.just(c())
+ } as Const
+ }
+
+ suspend operator fun invoke(c: suspend BindSyntax>.() -> A): Const =
+ suspendCoroutineUninterceptedOrReturn { cont ->
+ val continuation = ConstSContinuation(cont as Continuation>)
+ continuation.startCoroutineUninterceptedOrReturn {
+ Const.just(c())
+ }
+ }
+
+ internal class ConstSContinuation(
+ parent: Continuation>
+ ) : SuspendMonadContinuation, T>(parent) {
+ override fun ShortCircuit.recover(): Const =
+ throw this
+
+ override suspend fun Kind, B>.bind(): B =
+ value() as B
+ }
+
+ internal class ConstContinuation : MonadContinuation, T>() {
+ override fun ShortCircuit.recover(): Const =
+ throw this
+
+ override suspend fun Kind, B>.bind(): B =
+ value() as B
+ }
+}
diff --git a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/either.kt b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/either.kt
new file mode 100644
index 00000000000..a1748f3ea75
--- /dev/null
+++ b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/either.kt
@@ -0,0 +1,50 @@
+package arrow.core.computations
+
+import arrow.Kind
+import arrow.core.EagerBind
+import arrow.core.Either
+import arrow.core.EitherOf
+import arrow.core.EitherPartialOf
+import arrow.core.MonadContinuation
+import arrow.core.ShortCircuit
+import arrow.core.SuspendMonadContinuation
+import arrow.core.fix
+import arrow.core.identity
+import arrow.typeclasses.suspended.BindSyntax
+import kotlin.coroutines.Continuation
+import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
+
+object either {
+ fun eager(c: suspend EagerBind>.() -> A): Either {
+ val continuation: EitherContinuation = EitherContinuation()
+ return continuation.startCoroutineUninterceptedAndReturn {
+ Either.Right(c())
+ } as Either
+ }
+
+ suspend operator fun invoke(c: suspend BindSyntax>.() -> A): Either =
+ suspendCoroutineUninterceptedOrReturn { cont ->
+ val continuation = EitherSContinuation(cont as Continuation>)
+ continuation.startCoroutineUninterceptedOrReturn {
+ Either.Right(c())
+ }
+ }
+
+ internal class EitherSContinuation(
+ parent: Continuation>
+ ) : SuspendMonadContinuation, A>(parent) {
+ override fun ShortCircuit.recover(): Kind, A> =
+ Either.Left(value as E)
+
+ override suspend fun Kind, A>.bind(): A =
+ fix().fold({ e -> throw ShortCircuit(e) }, ::identity)
+ }
+
+ internal class EitherContinuation : MonadContinuation, A>() {
+ override fun ShortCircuit.recover(): Kind, A> =
+ Either.Left(value as E)
+
+ override suspend fun Kind, A>.bind(): A =
+ fix().fold({ e -> throw ShortCircuit(e) }, ::identity)
+ }
+}
diff --git a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/eval.kt b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/eval.kt
new file mode 100644
index 00000000000..73cf72bcec2
--- /dev/null
+++ b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/eval.kt
@@ -0,0 +1,49 @@
+package arrow.core.computations
+
+import arrow.Kind
+import arrow.core.EagerBind
+import arrow.core.Eval
+import arrow.core.EvalOf
+import arrow.core.ForEval
+import arrow.core.MonadContinuation
+import arrow.core.ShortCircuit
+import arrow.core.SuspendMonadContinuation
+import arrow.core.fix
+import arrow.typeclasses.suspended.BindSyntax
+import kotlin.coroutines.Continuation
+import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
+
+object eval {
+ fun eager(c: suspend EagerBind.() -> A): Eval {
+ val continuation: EvalContinuation = EvalContinuation()
+ return continuation.startCoroutineUninterceptedAndReturn {
+ Eval.just(c())
+ } as Eval
+ }
+
+ suspend operator fun invoke(c: suspend BindSyntax.() -> A): Eval =
+ suspendCoroutineUninterceptedOrReturn { cont ->
+ val continuation = EvalSContinuation(cont as Continuation>)
+ continuation.startCoroutineUninterceptedOrReturn {
+ Eval.just(c())
+ }
+ }
+
+ internal class EvalSContinuation(
+ parent: Continuation>
+ ) : SuspendMonadContinuation(parent) {
+ override fun ShortCircuit.recover(): Kind =
+ throw this
+
+ override suspend fun Kind.bind(): A =
+ fix().value()
+ }
+
+ internal class EvalContinuation : MonadContinuation() {
+ override fun ShortCircuit.recover(): Kind =
+ throw this
+
+ override suspend fun Kind.bind(): A =
+ fix().value()
+ }
+}
diff --git a/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/validated.kt b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/validated.kt
new file mode 100644
index 00000000000..e1a66ab7363
--- /dev/null
+++ b/arrow-libs/core/arrow-core-data/src/main/kotlin/arrow/core/computations/validated.kt
@@ -0,0 +1,52 @@
+package arrow.core.computations
+
+import arrow.Kind
+import arrow.core.EagerBind
+import arrow.core.Invalid
+import arrow.core.MonadContinuation
+import arrow.core.ShortCircuit
+import arrow.core.SuspendMonadContinuation
+import arrow.core.Valid
+import arrow.core.Validated
+import arrow.core.ValidatedOf
+import arrow.core.ValidatedPartialOf
+import arrow.core.fix
+import arrow.core.identity
+import arrow.typeclasses.suspended.BindSyntax
+import kotlin.coroutines.Continuation
+import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
+
+object validated {
+ fun eager(c: suspend EagerBind>.() -> A): Validated {
+ val continuation: ValidatedContinuation = ValidatedContinuation()
+ return continuation.startCoroutineUninterceptedAndReturn {
+ Valid(c())
+ } as Validated
+ }
+
+ suspend operator fun invoke(c: suspend BindSyntax>.() -> A): Validated =
+ suspendCoroutineUninterceptedOrReturn { cont ->
+ val continuation = ValidatedSContinuation(cont as Continuation>)
+ continuation.startCoroutineUninterceptedOrReturn {
+ Valid(c())
+ }
+ }
+
+ internal class ValidatedSContinuation(
+ parent: Continuation>
+ ) : SuspendMonadContinuation, A>(parent) {
+ override suspend fun Kind, A>.bind(): A =
+ fix().fold({ e -> throw ShortCircuit(e) }, ::identity)
+
+ override fun ShortCircuit.recover(): Kind, A> =
+ Invalid(value as E)
+ }
+
+ internal class ValidatedContinuation : MonadContinuation, A>() {
+ override suspend fun Kind, A>.bind(): A =
+ fix().fold({ e -> throw ShortCircuit(e) }, ::identity)
+
+ override fun ShortCircuit.recover(): Kind, A> =
+ Invalid(value as E)
+ }
+}
diff --git a/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/ConstTest.kt b/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/ConstTest.kt
index 32b5289361e..6ad68a8d3c4 100644
--- a/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/ConstTest.kt
+++ b/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/ConstTest.kt
@@ -1,6 +1,7 @@
package arrow.core
import arrow.Kind
+import arrow.core.computations.const
import arrow.core.extensions.const.applicative.applicative
import arrow.core.extensions.const.eq.eq
import arrow.core.extensions.const.functor.functor
@@ -41,7 +42,7 @@ class ConstTest : UnitSpec() {
ApplicativeLaws.laws(Const.applicative(M), Const.functor(), GENK, EQK),
EqLaws.laws(Const.eq(Eq.any()), GEN),
ShowLaws.laws(Const.show(Int.show()), Const.eq(Eq.any()), GEN),
- FxLaws.laws, Int>(GENK.genK(Gen.int()), GENK.genK(Gen.int()), EQK.liftEq(Int.eq()), ::const, ::const)
+ FxLaws.laws, Int>(GENK.genK(Gen.int()), GENK.genK(Gen.int()), EQK.liftEq(Int.eq()), const::eager, const::invoke)
)
}
}
diff --git a/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/EitherTest.kt b/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/EitherTest.kt
index 9cb557cb48b..96f7193a2b9 100644
--- a/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/EitherTest.kt
+++ b/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/EitherTest.kt
@@ -1,9 +1,9 @@
package arrow.core
import arrow.Kind
+import arrow.core.computations.either
import arrow.core.extensions.combine
import arrow.core.extensions.either.applicative.applicative
-import arrow.core.extensions.either.applicativeError.handleErrorWith
import arrow.core.extensions.either.bicrosswalk.bicrosswalk
import arrow.core.extensions.either.bifunctor.bifunctor
import arrow.core.extensions.either.bitraverse.bitraverse
@@ -71,7 +71,7 @@ class EitherTest : UnitSpec() {
SemigroupKLaws.laws(Either.semigroupK(), Either.genK(Gen.id(Gen.int())), Either.eqK(Id.eq(Int.eq()))),
HashLaws.laws(Either.hash(String.hash(), Int.hash()), GEN, Either.eq(String.eq(), Int.eq())),
BicrosswalkLaws.laws(Either.bicrosswalk(), Either.genK2(), Either.eqK2()),
- FxLaws.laws, Int>(Gen.int().map(::Right), GEN.map { it }, Either.eqK(String.eq()).liftEq(Int.eq()), ::either, ::either)
+ FxLaws.laws, Int>(Gen.int().map(::Right), GEN.map { it }, Either.eqK(String.eq()).liftEq(Int.eq()), either::eager, either::invoke)
)
"fromNullable should lift value as a Right if it is not null" {
diff --git a/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/EvalTest.kt b/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/EvalTest.kt
index e112ce12d22..68800d27438 100644
--- a/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/EvalTest.kt
+++ b/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/EvalTest.kt
@@ -1,6 +1,7 @@
package arrow.core
import arrow.Kind
+import arrow.core.computations.eval
import arrow.core.extensions.eq
import arrow.core.extensions.eval.applicative.applicative
import arrow.core.extensions.eval.bimonad.bimonad
@@ -38,7 +39,7 @@ class EvalTest : UnitSpec() {
testLaws(
BimonadLaws.laws(Eval.bimonad(), Eval.monad(), Eval.comonad(), Eval.functor(), Eval.applicative(), Eval.monad(), GENK, EQK),
- FxLaws.laws(G, G, EQK.liftEq(Int.eq()), ::eval, ::eval)
+ FxLaws.laws(G, G, EQK.liftEq(Int.eq()), eval::eager, eval::invoke)
)
"should map wrapped value" {
diff --git a/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/ValidatedTest.kt b/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/ValidatedTest.kt
index 2bcbac3f0f8..ffc511efebe 100644
--- a/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/ValidatedTest.kt
+++ b/arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/core/ValidatedTest.kt
@@ -1,5 +1,6 @@
package arrow.core
+import arrow.core.computations.validated
import arrow.core.extensions.eq
import arrow.core.extensions.monoid
import arrow.core.extensions.semigroup
@@ -60,7 +61,7 @@ class ValidatedTest : UnitSpec() {
Validated.genK2(),
Validated.eqK2()
),
- FxLaws.laws, Int>(Gen.int().map(::Valid), Gen.validated(Gen.string(), Gen.int()).map { it }, Validated.eqK(String.eq()).liftEq(Int.eq()), ::validated, ::validated)
+ FxLaws.laws, Int>(Gen.int().map(::Valid), Gen.validated(Gen.string(), Gen.int()).map { it }, Validated.eqK(String.eq()).liftEq(Int.eq()), validated::eager, validated::invoke)
)
"fold should call function on Invalid" {
diff --git a/arrow-libs/core/arrow-core/src/main/kotlin/arrow/core/extensions/either.kt b/arrow-libs/core/arrow-core/src/main/kotlin/arrow/core/extensions/either.kt
index dde825c562e..aa30b985b37 100644
--- a/arrow-libs/core/arrow-core/src/main/kotlin/arrow/core/extensions/either.kt
+++ b/arrow-libs/core/arrow-core/src/main/kotlin/arrow/core/extensions/either.kt
@@ -254,7 +254,7 @@ interface EitherHash : Hash>, EitherEq {
}
@Deprecated("Fx blocks are now named based on each datatype, please use `either { }` instead",
- replaceWith = ReplaceWith("either(c)"))
+ replaceWith = ReplaceWith("either.eager(c)"))
fun Either.Companion.fx(c: suspend MonadSyntax>.() -> R): Either =
Either.monad().fx.monad(c).fix()
diff --git a/arrow-libs/core/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt b/arrow-libs/core/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt
index 5a55dd64bf5..6f661714a14 100644
--- a/arrow-libs/core/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt
+++ b/arrow-libs/core/arrow-core/src/main/kotlin/arrow/core/extensions/eval.kt
@@ -90,7 +90,7 @@ interface EvalBimonad : Bimonad {
override fun EvalOf.flatMap(f: (A) -> EvalOf): Eval =
fix().flatMap(f)
- override fun tailRecM(a: A, f: kotlin.Function1>>): Eval =
+ override fun tailRecM(a: A, f: (A) -> EvalOf>): Eval =
Eval.tailRecM(a, f)
override fun EvalOf.map(f: (A) -> B): Eval =
@@ -107,6 +107,6 @@ interface EvalBimonad : Bimonad {
}
@Deprecated("Fx blocks are now named based on each datatype, please use `eval { }` instead",
- replaceWith = ReplaceWith("eval(c)"))
+ replaceWith = ReplaceWith("eval.eager(c)"))
fun Eval.Companion.fx(c: suspend MonadSyntax.() -> B): Eval =
defer { Eval.monad().fx.monad(c).fix() }