[Haskell-cafe] GUIs, FRP, (Delimited) Continuations and Zippers
g9ks157k at acme.softbase.org
Tue May 19 05:30:52 EDT 2009
Am Samstag, 16. Mai 2009 16:18 schrieb Günther Schmidt:
> Hi all,
> In my app, there is one part which has a rather complicated GUI logic,
> it involves n drop downs with n choices each.
> Whenever the current selection in one of the drop downs changes by user
> interaction, the other (n-1) drop downs need to be notified and their
> item list need to possible change too.
> Now I have managed to code all this and it actually behaves correctly.
> But I'm also using tons of IORefs and tons of bookkeeping code for it.
> While I'd not be ashamed to show any other part of my code to another
> Haskeller, this part of the code is the most clumsiest I've ever written.
> And I have no clue if that piece of code *can* be written in any other
> way, ie. without the tons of IORefs and bookkeeping.
> The GUI library is WXHaskell.
> In the last few days I read up on Conal Elliotts FRP stuff (reactive)
> but also on Olegs ZFS (Zippers, Delimited Continuations), the latter
> leaving me totally baffled.
> Could either of those approaches (FRP / Delimited Continuations) be a
> solution for implementing complex GUI code?
FRP can definitely help you a lot for these kinds of problems. You have n
widgets where each widget outputs a discrete signal (event (stream)) of
requests from the user. These are transformed and combined to form signals
(behaviors) that describe the contents of the n widgets over time.
Have you looked at Grapefruit? It’s an FRP library, I’m developing, which
already has integrated GUI support. If you want to try it out, better take
the darcs version instead of the released version since there have been some
important developments since the release date. You find Grapefruit’s homepage
here: <http://haskell.org/haskellwiki/Grapefruit>. If you have questions,
More information about the Haskell-Cafe