[Haskell-cafe] Expanding do notation
Robin Green
greenrd at greenrd.org
Sat Jan 7 11:54:25 EST 2006
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
More information about the Haskell-Cafe
mailing list