Thanks much for these thoughtful questions and implementation perspectives.<br><br>Internally, Phooey works very like an imperative GUI program, pushing computations when inputs change.&nbsp; So I'd expect it to have pretty much the same performance properties.&nbsp;&nbsp; As you mentioned, lazy evaluation can play a role in making evaluation subtler.&nbsp; The laziness probably doesn't work out as nicely as we'd like, however.&nbsp; On an input change, a new output value is constructed lazily, but then a call is to the underlying low-level gui toolkit (eg wxWidgets), which will cause the output value to be fully evaluated.&nbsp; I'm assuming that wxHaskell doesn't do clever postponing &amp; collapsing of output calls to wxWidgets.&nbsp; But perhaps it could do so, or Phooey could do so on top of wxHaskell.&nbsp; Probably a good idea, and it certainly hadn't occurred to me.
<br><br>The paper I'm working is partly about Phooey the interface, but more about systematically refactoring the imperative programming style into the Phooey interface and its implementation.&nbsp; This derivation is why I believe that Phooey is operationally very like the imperative approach (while presenting a radically different interface).&nbsp; It could be that Phooey internally operates like a 
<span style="font-style: italic;">naive</span> imperative GUI program, of the sort I tend to write.<br><br>Thanks also for the suggested example and discussion of requirements of the underlying imperative toolkit.<br><br>
Best regards, - Conal<br><br><div><span class="gmail_quote">On 12/12/06, <b class="gmail_sendername">Brian Hulley</b> &lt;<a href="mailto:brianh@metamilk.com">brianh@metamilk.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Brian Hulley wrote:<br>&gt; Conal Elliott wrote:<br>&gt;<br>&gt;&gt; GUIs are usually programmed in an &quot;unnatural&quot; style, in that ...<br>&gt;<br>&gt; Also, suppose you have a gui consisting of an edit widget such that
<br>&gt; when the user types something it gets lexed, parsed, and fontified as<br>&gt; a Haskell program, ie from the user's point of view the widget<br>&gt; maintains a syntax highlighted view of the code which is<br>&gt; &quot;continuously&quot; updated. Would your system do the lexing/parsing for
<br>&gt; every key that was pressed or only once, when the widget needs to be<br>&gt; re-rendered (a typical gui for Windows would only propagate changes<br>&gt; and re-draw the gui (ie lex/parse/fontify) when there are no event
<br>&gt; messages pending)?<br><br>Thinking about this more, a better example would be a gui with 2 widgets: an<br>edit widget to type in code and a list widget which displays a list of top<br>level functions defined in that code. (The code could be Haskell or some
<br>simple toy language.)<br>Then the question becomes: how to set things up such that the code in the<br>edit widget is only parsed when the list widget (and/or edit widget) is<br>asked to render it's contents rather than every time the user presses a key.
<br>I think perhaps the problem would be solved by the edit widget passing a<br>lazy parse tree (ie an expression evaluating to the parse tree) to the list<br>widget.<br><br>But an interesting thing is if you compare this to imperative guis, in the
<br>functional gui each widget passes lazy expressions eagerly whereas in<br>imperative guis each widget passes eagerly evaluated expressions lazily ie<br>functional is &quot;push messages&quot; whereas imperative is &quot;pull changes when I'm
<br>asked to pick or render something etc and I'm dirty&quot;. (Have I got this<br>wrong?)<br><br>I imagine that the overhead of eager passing in the functional gui is a<br>small price to pay for the ease of using a functional gui, since the
<br>important thing is that in both guis, the hard work of parsing the code in<br>the edit buffer would only be done on demand, unless I'm much mistaken.<br><br>If you're still thinking of examples for your paper it would also be really
<br>great to see how you'd create a widget that displays the result of another<br>process (eg a window that displays the output as ghc compiles a program) or<br>some other example of how to use the IO monad inside a widget for those
<br>unfamiliar with combining arrows with monads.<br><br>It would also be useful to know more about the relationship between the<br>functional gui and WxWidgets to see what characteristics an imperative gui<br>toolkit must have in order to be usable with it. (Like the extremely useful
<br>discussion of low level details in the Fudgets thesis.)<br><br>Best regards, Brian.<br>--<br><a href="http://www.metamilk.com">http://www.metamilk.com</a><br><br></blockquote></div><br>