4 ms·
Does Haskell provide tail-call optimization or similar optimization to take away the stack-space costs of recursive function calls?
by mr_overalls 9y ago
Does Haskell provide tail-call optimization or similar optimization to take away the stack-space costs of recursive function calls?
- Terribledactyl 9y agoGHC can, if you want it to. It's hard to answer in a general way because of the laziness, and you can always force evaluation. But then you rob GHC of potentially better optimizations, like never executing it in the first place. This SO does a good job of explaining the trade offs. https://stackoverflow.com/questions/13042353/does-haskell-have-tail-recursive-optimization https://stackoverflow.com/questions/13042353/does-haskell-ha...