Why no stack overflow in ghci?
Albert Y. C. Lai
trebla at vex.net
Tue Jul 26 23:41:17 CEST 2011
On 11-07-26 03:57 PM, Roman Cheplyaka wrote:
> 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)
To enjoy unlimited stack in compiled code, add +RTS -K10
To enjoy limited stack in ghci, add +RTS -K8M
To know why, see my
More information about the Glasgow-haskell-users