Hi, since we are all talking about `Effect` I woul...
# arrow
p
Hi, since we are all talking about
Effect
I would have one question too. Is it possible to compose multiple `Effect`s? For example:
Copy code
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>
s
Hey @Pavel, Yes, the
effect
block allows for a special DSL.
Copy code
effect {
  val num = test().bind()
  val num2 = test2(num).bind()
  num + num2
}
It also exposes functionality such as
Either#bind
,
ensureNotNull
etc
I noticed
Effect
is not linked on the Arrow Core homepage overview. https://arrow-kt.io/docs/apidocs/arrow-core/arrow.core.continuations/-effect/
👍 1
p
Hi @simon.vergauwen, thanks for your speedy reply, so
bind()
should be used to connect `Effect`s. I tried it now and it works 🙂
🙌 1