
On Wed, 21 Dec 2005, Tomasz Zielonka wrote:
On Wed, Dec 21, 2005 at 06:58:14PM +0000, Philippa Cowderoy wrote:
Surely the actual explosion comes about because PutStr forces the lot at once? If PutStr were to evaluate a character at a time, the laziness would be slow and spew a lot of garbage to collect but not hang on to as much space as you suggest.
Try running
putStrLn (unlines (repeat "hello!"))
You may be surprised ;-)
Or not ;-) But yes, I should've checked and my comments on how that'll behave stand. It would be nice to think something clever could happen regarding memory management as well, but I'm familiar enough with GCed systems by now to be somewhat wary of cleverness. -- flippa@flippac.org A problem that's all in your head is still a problem. Brain damage is but one form of mind damage.