[Haskell-cafe] Re: Tutorial uploaded
Philippa Cowderoy
flippa at flippac.org
Wed Dec 21 14:13:07 EST 2005
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 at flippac.org
A problem that's all in your head is still a problem.
Brain damage is but one form of mind damage.
More information about the Haskell-Cafe
mailing list