Skip to content

Instantly share code, notes, and snippets.

@kawakami-o3
Created September 3, 2012 13:05
Show Gist options
  • Save kawakami-o3/3609211 to your computer and use it in GitHub Desktop.
Save kawakami-o3/3609211 to your computer and use it in GitHub Desktop.
Stack space overflow: current size 8388608 bytes.
sum :: Int -> Int
sum = sum' 0
where
sum' acc n | n<1 = acc
| otherwise = sum' (acc+n) (n-1)
main = do
putStrLn (show (Main.sum (2^24)))
@kawakami-o3
Copy link
Author

$ ghc main.hs && ./main
[1 of 1] Compiling Main ( main.hs, main.o )
Linking main ...
Stack space overflow: current size 8388608 bytes.
Use `+RTS -Ksize -RTS' to increase it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment