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

> This is because sequence is implemented as
>
>      sequence (m:ms) = do x <- m
>                           xs <- sequence ms
>                           return (x:xs)
>
> and uses stack space when used on some [IO a].
>

This problem is not due to sequence, which doesn't need to add any
strictness here. It occurs because the functions in System.Random are
excessively lazy. In particular, randomIO returns an unevaluated thunk.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to