[Haskell-cafe] Does the GHC GC handle const application?

David Feuer david.feuer at gmail.com
Tue May 31 11:48:28 UTC 2016


Currently, `adjust` is probably *too* lazy. When called, it places a thunk
right at/below the root of the tree. This can lead to thunks building up
around the root if multiple nodes are adjusted between inspections. I'm
strongly considering modifying it to install its thunk at the appropriate
leaf instead. Thinking about this, I realized that even with that
modification, calling `update` multiple times on the same index could
potentially lead to thunks building up around the leaf, even though this is
never necessary.
On May 31, 2016 3:20 AM, "Tom Ellis" <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:

> On Mon, May 30, 2016 at 08:13:41PM -0400, David Feuer wrote:
> > If I create a thunk representing
> >
> > const x y
> >
> > will the garbage collector be sure to replace this with x?
>
> Not until it's evaluated, no.
>
> > I'm just wondering if I have to be concerned about the fact that
> > Data.Sequence defines update in terms of adjust, with
> >
> > update x = adjust (const x)
>
> Could you say more about your concern?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160531/b54f0653/attachment.html>


More information about the Haskell-Cafe mailing list