Piotr Krzemiński
02/13/2023, 2:56 PMEval
.
• 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 ☝️simon.vergauwen
02/13/2023, 2:58 PMPiotr Krzemiński
02/13/2023, 2:59 PMsimon.vergauwen
02/13/2023, 3:02 PMI’m struggling to understand what’s the point ofOn the JVM we have the issue of stack-safety, and when working over.Eval
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.Anand Verma
02/13/2023, 3:04 PMsimon.vergauwen
02/13/2023, 3:06 PMAnand Verma
02/13/2023, 3:31 PM