[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
Wed Sep 4 17:35:17 CEST 2013

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")


More information about the Haskell-Cafe mailing list