[Haskell] Excessive sharing and GHC

John Meacham john at repetae.net
Tue Oct 18 18:02:30 EDT 2005

On Wed, Oct 19, 2005 at 12:01:07AM +0200, Daan Leijen wrote:
> John Meacham wrote:
> >On Tue, Oct 18, 2005 at 08:31:19AM +0100, Simon Peyton-Jones wrote:
> >>GHC tries not to create space leaks, but does not guarantee not to.  In
> >>particular, the full laziness transformation is so beneficial most of
> >>the time that, even though it can create a space leak GHC still does it
> >>(unless you turn it off with a flag).
> >
> >I was thinking it would be nice if one could put a pragma on CAFs that
> >basically made ghc treat them as WHNF so it would float them inward as
> >far as possible including inside lambdas. in particular, constant
> >strings that are created (cheaply) from efficient internal
> >representations should not be held onto in their inefficient form.
> What about adding a unit argument? That would do the trick without pragmas.

I believe that full-lazyness will still take the body of the routine
and float it to the top as a CAF.
as in if we have

foo () = fromPackedString big_string

then the (fromPackdString big_string) will be floated out by the
standard full lazyness transform (as I understand it)


John Meacham - ⑆repetae.net⑆john⑈ 

More information about the Haskell mailing list