<p><br>
On Mar 22, 2012 2:56 AM, &quot;Victor Miller&quot; &lt;<a href="mailto:victorsmiller@gmail.com">victorsmiller@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; I was writing a Haskell program which builds a large labeled binary tree and then does some processing of it, which is fold-like.  In the actual application that I have in mind the tree will be *huge*.  If the whole tree is kept in memory it would probably take up 100&#39;s of gigabytes.  Because of the pattern of processing the tree, it occurred to me that it might be better (cause much less paging) if some large subtrees could be replaced by thunks which can either recalculate the subtree as needed,</p>

<p>This sounds like weak references (warning this is tricky stuff),<br>
 <a href="http://www.haskell.org/ghc/docs/7.0.2/html/libraries/base-4.3.1.0/System-Mem-Weak.html">http://www.haskell.org/ghc/docs/7.0.2/html/libraries/base-4.3.1.0/System-Mem-Weak.html</a> </p>
<p> or write out the subtree, get rid of the references to it (so it can be garbage collected) and then read back in (perhaps in pieces) as needed.  This could be fairly cleanly expressed monadically.  So does anyone know if someone has created something like this?<br>

&gt;<br>
&gt; Victor<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Haskell-Cafe mailing list<br>
&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt;<br>
</p>