
7 Jan
2006
7 Jan
'06
11:54 a.m.
David F. Place wrote:
Hi All,
Is there a program for expanding 'do' notation? I am trying to understand why the following code (from the Fannkuch entry) doesn't hold onto the list 'p' causing a space leak.
You can desugar (i.e. expand) the do notation relatively easily, but that won't tell you what optimisations are being performed (e.g. code rearrangements) if any. Of course the compiler can't perform IO actions in the wrong order - but it can in principle generate code which generates a value from p early on, and then p can be garbage collected. I have no idea whether that's what's happening here, though. -- Robin