[Haskell-cafe] types and number of evaluation steps
Jake McArthur
jake.mcarthur at gmail.com
Tue Feb 21 14:20:39 CET 2012
My understanding was that the reason is that CSE can cause things to be
shared that take up a lot of space when normally they would be garbage
collected sooner.
On Feb 18, 2012 11:57 AM, "Roman Cheplyaka" <roma at ro-che.info> wrote:
> It doesn't matter. Laziness would be affected if, for instance,
> something is not evaluated without CSE and is evaluated with it.
>
> In your example either all or none of 'a' and 'b' get evaluated,
> depending on whether the top-level expression is evaluated.
>
> * Victor Gorokgov <me at rkit.pp.ru> [2012-02-18 18:23:19+0400]
> > example = a + b + a + b
> >
> > exampleCSE = x + x
> > where x = a + b
> >
> > With CSE we are introducing new thunk: x.
> >
> > 18.02.2012 17:38, Roman Cheplyaka пишет:
> > >* Holger Siegel<holgersiegel74 at yahoo.de> [2012-02-18 12:52:08+0100]
> > >>You cannot. Common subexpression elimination is done by GHC very
> > >>conservatively, because it can not only affect impure programs: it can
> > >>also affects strictness/lazyness and worsen memory usage of pure code.
> > >>Like the HaskellWiki says: "If you care about CSE, do it by hand."
> > >How can it affect strictness or laziness?
>
> --
> Roman I. Cheplyaka :: http://ro-che.info/
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120221/5019b95f/attachment.htm>
More information about the Haskell-Cafe
mailing list