
26 Jul
2011
26 Jul
'11
3:57 p.m.
The code main = print $ foldl (+) 0 [1..1000000] when compiled (without optimizations) results in a stack overflow, which is expected. However, when run from ghci it succeeds. Why is it so? (Tested with GHC 6.12.something and 7.0.4) Is it related to "stack-squeezing"? I couldn't find any description of it, apart from a few bug reports. A related question: how can I control the stack size in evaluations inside ghci? Is it (roughly) the same as setting the ghci's own stack size by passing -K to it in the command line? -- Roman I. Cheplyaka :: http://ro-che.info/