[Haskell-cafe] Nested unsafePerformIO?

2010-04-08 Thread DavidA
Hi, I am having difficulty debugging a troublesome stack overflow, which I think might be related to calling unsafePerformIO from within the IO monad. So I have the following code: import System.Random import System.IO.Unsafe import Data.Time.Clock timedIterateIO :: Int - (a - a) - a - IO a

Re: [Haskell-cafe] Nested unsafePerformIO?

2010-04-08 Thread Bas van Dijk
It looks like your timedIterateIO is too lazy. When you pass it a function like (+1) what will happen is that a large chunk of the form ...+1+1+1+1+1 is build up on your heap. When you finally need its value the large chunk will be evaluated causing it to push the '1' arguments on the stack. When