https://kotlinlang.org logo
#arrow
Title
# arrow
p

Piotr Krzemiński

02/13/2023, 2:56 PM
I’m reading https://adventures92.medium.com/kotlin-arrow-kt-eval-monad-a-beginners-guide-bff50e49d07c and I’m struggling to understand what’s the point of
Eval
. •
Eval.now
- the author says that “This is the equivalent of just calling a function normally in Kotlin.” •
Eval.later
- how is it different from
lazy
delegated property? •
Eval.always
- how is it different from just calling a function each time? I presume that the examples in the article didn’t fully utilize the power of this monad, like chain it in a creative way. Is it the case? If not, I’d be grateful for any explanation on the above ☝️
@Anand Verma 🙂 just noticed you’re here on Slack
s

simon.vergauwen

02/13/2023, 2:58 PM
p

Piotr Krzemiński

02/13/2023, 2:59 PM
ok, that’s a bit of a bummer from the article’s perspective 😄 could you reveal why you decided to remove them?
s

simon.vergauwen

02/13/2023, 3:02 PM
I’m struggling to understand what’s the point of
Eval
.
On the JVM we have the issue of stack-safety, and when working over
F
, or wrappers, you cannot use
tailrec
. So we there is a need to resort to special tricks to make wrappers stack-safe. Originally the point of
Eval
was to create stack-safe implementations of
Traverse
, but we have since then overcome this need and found simpler solutions. I.e. we can use
tailrec
with
suspend
, and you can use
bind
with
Iterable#map
etc. So the need for
Eval
has kind-of disappeared within the use-case of
wrappers
. The Kotlin Std has since then also added
DeepRecursiveFunction
which when we originally had
Eval
did not exist.
a

Anand Verma

02/13/2023, 3:04 PM
I guess this article need an update and a bit more explanation. Thanks you @Piotr Krzemiński for picking it out.
s

simon.vergauwen

02/13/2023, 3:06 PM
@Anand Verma if you want someone to proof read feel free to share it here or in #arrow-contributors ☺️ There is plenty of people happy to help!
Same goes for other blogs you plan to write 😉
a

Anand Verma

02/13/2023, 3:31 PM
Thanks @simon.vergauwen thanks a ton for your valuable feedback.
7 Views