2 ms·
I tried sum in GHC and it ate up my 16 gigs of ram and then crashed. I'm a noob so maybe I did something wrong, but my code was: main = do putStrL
by cgag 13y ago
I tried sum in GHC and it ate up my 16 gigs of ram and then crashed. I'm a noob so maybe I did something wrong, but my code was:
main = do
putStrLn $ show $ sum [1..1000000000]
- TheCoelacanth 13y agoPass GHC the -O2 option to turn on optimizations. You need the strictness analyzer to run so that it can determine that sum is strict, otherwise you get a space leak.
- cgag 13y agoThank you :)