I was away from Arrow for some time and two days a...
# arrow
m
I was away from Arrow for some time and two days ago I came across
Effect
. can somebody give me concrete example where difference between
Effect
and
Either
is clear?
s
m
read the blog post, not completely clear but I understood most about
Effect
from there
Stack Overflow answer answers it for me, thanks
plus1 1
👍 1
r
Rather than Effect vs Either with multiple context receiver is more about EffectScope<E> vs Either<E, *>.
with multiple context receivers you can use the
EffectScope
to make
Either
disappear.
Copy code
context(EffectScope<E>)
suspend fun <E, A> foo(): A = shift(e)
vs
Copy code
suspend fun <E, A> foo(): Either<E, A> = Left(e)
🔝 1
With
EffectScope
you can use
shift
as a functional
throw
which can return an alternative value of
E
when otherwise the happy path of your function return type remains simple as just
A
👍 2
m
interesting, thanks for the explanation. that really looks neat