RE: Another question about sharing
Well, how about the following little circular program?
paths :: () -> [Path] paths () = let r = T : branch r in r
As far as I can understand what you are looking for, I think this meets the bill. Every use of the expression `paths ()' will re-evaluate the infinite structure to the extent its context requires it, and the expanded value will be thrown away as soon as the value of this instance of `paths ()' is no longer required.
You can't rely on adding dummy arguments to cause re-evaluation: full-laziness (enabled when optimisation is on in GHC) will do the opposite transformation. Cheers, Simon
You can't rely on adding dummy arguments to cause re-evaluation: full-laziness (enabled when optimisation is on in GHC) will do the opposite transformation.
Well in this case, you may find it harder to claim that the full laziness transformation constitutes an `optimisation'. Maybe the GHC manual should have a section on "Flags for worsening the space behaviour of programs". :-) Seriously, would it be difficult to detect when performing this `optimisation' would introduce a CAF and perhaps back it out appropriately? Regards, Malcolm
participants (2)
-
Malcolm Wallace -
Simon Marlow