Hey since there aren’t stupid questions... Why doe...
# arrow
t
Hey since there aren’t stupid questions... Why does
foldRight
on
Either
make use of an
Eval<C>
?
p
Because it’s a recursive operation it can end in Stackoverflow. foldLeft can be tail-call optimized (a term to google!), but foldRight requires holding the value so it can end up blowing up the stack. To prevent that you need to put evaluation on an event loop, so it resets the stack, in something called trampolining (another trip to google there). Eval in this case is our structure for that.
t
Thanks, that’s exactly what I needed to figure this out!
🤗 1