> IIRC, GHC does the tuning, i.e. CAFs are garbage collected in a clever
> way (describe in SPJ's book, I think), e.g. if there is only one
> reference into the "middle" of a CAF left, only that part is 
> kept alive.
> and not the wohle CAF. Comments from Mr. GC?   :-)

True, but this doesn't solve the space leak associated with full-laziness.
If the entire list happens to be still required, it'll be kept around,
whereas if the full-laziness transformation hadn't lifted it to the top
level the list would be recomputed every time (O(n) vs. O(1) space
requirements respectively).

Fortunately it seems that this doesn't bite in practice, except in certain
pathological cases, so implementing full-laziness is a big win on average.

Cheers,
        Simon


Reply via email to