<div dir="ltr">Thanks, Heinrich!<br><br>Reactive Banana's front page on Hackage [1] indicates that Reactive.Banana.Switch offers "no garbage collection for events that are created dynamically". Does that mean one has to collect the garbage oneself, or does it mean that garbage cannot be collected at all?<br><br>My eventual goal is to write a mindmap editor, ala Freeplane. There might never be more than fifty or so frames of text on display at any one time, but in a single session I can easily imagine drawing hundreds of thousands of them. (For that estimate I am assuming a single line of text in the model would require a new frame each time it is redisplayed; if instead a frame could persist invisibly and be redrawn later, most sessions would, I imagine, involve fewer than five thousand frames -- but even then it's not obvious to me that I could forego garbage collection.)<br><br>[1] <a href="https://hackage.haskell.org/package/reactive-banana">https://hackage.haskell.org/package/reactive-banana</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 13, 2015 at 11:04 PM, Heinrich Apfelmus <span dir="ltr"><<a href="mailto:apfelmus@quantentunnel.de" target="_blank">apfelmus@quantentunnel.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Jeffrey Brown wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear list,<br>
<br>
I want to write an application in which the set of widgets in existence,<br>
and the subset of them that is displayed, depends on user input. I am using<br>
reactive-banana. So far the simplest spec I have imagined for it is this:<br>
<br>
    Initially there is just a text entry box and an empty (hence invisible)<br>
collection of labels.<br>
<br>
    The user can do two things: enter the word "add", or enter an integer.<br>
<br>
    Entering the word "add" causes a label to be added to the collection,<br>
but not displayed. The labels require no text content.<br>
<br>
    Entering an integer N causes the first N labels to be displayed<br>
onscreen. The text entry box remains visible.<br>
<br>
I am totally baffled. In particular, the Behavior paradigm, though it is<br>
elegant and beautiful whenever I study it, I have no idea how to apply.<br>
</blockquote>
<br></div></div>
This looks like you need "dynamic event switching", i.e. the module `Reactive.Banana.Switch`. It's very cool, but may be more difficult to understand than the standard combinators, mainly because of the additional type parameters.<br>
<br>
To see how it works, have a look at the `BarTab.hs` example. It implements a program that is very similar to what you describe here.<br>
<br>
<br>
Best regards,<br>
Heinrich Apfelmus<br>
<br>
--<br>
<a href="http://apfelmus.nfshost.com" target="_blank">http://apfelmus.nfshost.com</a><br>
<br>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>