On Mon, Aug 26, 2013 at 4:46 AM, Niklas Hambüchen <m...@nh2.me> wrote:

> 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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to