[Haskell-cafe] Strange IO sequence behaviour (Was: sequence causing stack overflow on pretty small lists)
Tom Ellis
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Sep 6 21:31:31 CEST 2013
On Wed, Sep 04, 2013 at 04:35:17PM +0100, Tom Ellis wrote:
> As an addendum to the recent discussion, can anyone explain why main crashes
> quickly with a stack overflow, whereas main' is happy to print "Hi" for ages
> (eventually crashing due to an out of memory condition)?
>
> bignum = 100 * 1000 * 1000
> main = replicateM bignum (return ())
> main' = replicateM bignum (putStrLn "Hi")
FYI, rwbarton on Reddit produced a nice answer:
http://www.reddit.com/r/haskell/comments/1luan1/strange_io_sequence_behaviour/cc32ec4
More information about the Haskell-Cafe
mailing list