
27 Aug
2013
27 Aug
'13
7:37 a.m.
On Mon, Aug 26, 2013 at 4:46 AM, Niklas Hambüchen
On #haskell we recently had a discussion about the following:
import System.Random
list <- replicateM 1000000 randomIO :: IO [Int]
I would think that this gives us a list of a million random Ints. In fact, this is what happens in ghci. But with ghc we get:
Stack space overflow: current size 8388608 bytes. Use `+RTS -Ksize -RTS' to increase it.
You can use ContT to force the function to use heap instead of stack space, e.g. runContT (replicateM 1000000 (lift randomIO)) return