Skip to content

Comment on Recursion, Tail Calls and Trampolines in JavaScript (2015)

Comments

In case you need a trampoline, it's more comfortable to use a well grown data type. Here's mine ...

Eval, a data-type for handling synchronous evaluation: https://funfix.org/api/effect/classes/eval.html

IO, a data-type for suspending side effects, including asynchronous ones, an FP/lawful replacement for Promise; ported from Haskell, but better: https://funfix.org/api/effect/classes/io.html

Also note that Promise's implementation leaks memory in "then" chains, so be cautious when using Promises to work around JavaScript's call-stack — https://alexn.org/blog/2017/10/11/javascript-promise-leaks-m...

use a well grown data type

What does 'well grown' mean in the context of data types?

Lawful.

I've heard of lawful but never 'well grown' - where does the term come from?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.