Pavel
05/16/2022, 7:26 AMEffect
I would have one question too. Is it possible to compose multiple `Effect`s? For example:
fun test(): Effect<X, Int> = effect {
1
}
fun test2(num: Int): Effect<X, Int> = effect {
num + 1
}
(test().flatMap { num -> test2(num) }): Effect<X, Int>
simon.vergauwen
05/16/2022, 7:32 AMeffect
block allows for a special DSL.
effect {
val num = test().bind()
val num2 = test2(num).bind()
num + num2
}
simon.vergauwen
05/16/2022, 7:34 AMEither#bind
, ensureNotNull
etcsimon.vergauwen
05/16/2022, 7:34 AMEffect
is not linked on the Arrow Core homepage overview.
https://arrow-kt.io/docs/apidocs/arrow-core/arrow.core.continuations/-effect/Pavel
05/16/2022, 8:24 AMbind()
should be used to connect `Effect`s. I tried it now and it works 🙂