4 ms·
GHC 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 potential
by Terribledactyl 9y ago
GHC 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...