<div dir="ltr">Hello, I'm a bit confused on how to design graphical widgets to take advantage of FRP design. I'm trying to do things in threepenny-gui but I suppose the same question applies to any framework.<div><br>
<div>Suppose I want to create a "file selection widget". Currently I have a function that takes a (FilePath -> UI()) function as a parameter: what to do when a file is selected; my function returns the "widget", so that the calling code can incorporate it in its UI. This works fine, but is not FRP, right?</div>
<div><br></div><div>Should my function take no arguments and return a (Widget,Event FilePath) tuple, and let the calling code decide what to do with that event? Should it be a Behavior (the currently selected file of the widget)? I *think* I understand the principles of FRP, but I'm not getting what it means in terms of design. What are the advantages of returning an Event and letting the calling code do "on myEvent myWidget $ \file -> ..." instead of just passing the handler function as a parameter?</div>
<div><br></div><div>I don't know if I make much sense. In any case, any pointer to non trivial FRP GUI code would be good!</div><div><br></div><div>Thanks a million all,</div><div><div><br></div>-- <br>JP Moresmau<br>
<a href="http://jpmoresmau.blogspot.com/">http://jpmoresmau.blogspot.com/</a>
</div></div></div>