3 ms·
The OP (which I totally agree with!) also states: > Such a compiler could properly determine that intermediate steps are unused, merge them (e.g. translate x.m
by cpa 12y ago
The OP (which I totally agree with!) also states:
> Such a compiler could properly determine that intermediate steps are unused, merge them (e.g. translate x.map(f).map(g) to x.map(x => g(f(x))))
Ironically, GHC does that already[0], and will also do TCO.
[0] http://metagraph.org/papers/stream_fusion.pdf http://metagraph.org/papers/stream_fusion.pdf