[Haskell-cafe] Stack overflow in simple code with getStdRandom / randomR (GHC)

2011-04-19 Thread Volker Stolz
The following three-liner creates a stack overflow (on my machine, MacOS), and I'm a bit puzzled as to why: import System.Random main = do mapM (const (getStdRandom (randomR (0, 5::Int [0..1000] botanix:~ stolz$ ./a.out Stack space overflow: current size 8388608 bytes. Use

Re: [Haskell-cafe] Stack overflow in simple code with getStdRandom / randomR (GHC)

2011-04-19 Thread Henning Thielemann
On Tue, 19 Apr 2011, Volker Stolz wrote: The following three-liner creates a stack overflow (on my machine, MacOS), and I'm a bit puzzled as to why: import System.Random main = do mapM (const (getStdRandom (randomR (0, 5::Int [0..1000] botanix:~ stolz$ ./a.out Stack space

Re: [Haskell-cafe] Stack overflow in simple code with getStdRandom / randomR (GHC)

2011-04-19 Thread Volker Stolz
Blimey, I didn't notice that Krzysztof came to the same conclusion a bit earlier today, so I guess the answer is somewhere in his remark One possible solution is to make cell holding std gen strict.. I'd still be interested in how to profile for this scenario, though. -Volker