
Hi all, I just though I'd let y'all know that I've started work on "Dingo", a small framework for creating Rich Internet Applications (RIA) in Haskell. The basic idea is that you write Haskell code and the framework generates all the browser-related bits you need (HTML, JS, state serialization, etc.) at runtime. Writing an application is centered around Widgets and Events which are just what you'd expect if you were writing a Gtk+/Swing/SWT/Qt application. The way the application starts is that you provide a "start the application" callback to a "runServer" function. When a client connects to the server the first time, the "main" callback gets run and can set up the main application widget however it wants. There's a basic example in Main (see attachment). It doesn't really do much interesting, but it does demonstrate that state transfer and updates (client->server and server->client) work and that events work at a basic level. I've attached a tarball of my not-even-close-to-pre-alpha code -- I won't bother putting this on Hackage since it's not actually useful for any real work yet. To get something working in a browser ASAP I've taken some... uhm, liberties with code quality, so I will not be held responsible for self-induced eye-gouging as a result of looking at the code. The current status is basically: * Uses Happstack-server for serving HTTP. Given Dingo's extremely simple serving needs it may be a bit of a "heavy" dependency, but it works for now and it's not really a high priority to change this. It's also definitely NOT eye-gouging-inducing, so that's a plus :). * Only very simple widgets are included: A "panel" container widget (corresponds to an unstyled <div/> currently) and "input", "select" and "button" elements (corresponding to their HTML counterparts). The idea is that Panel will be expanded to a more general container which can lay out subwidgets horizontally or vertically. * ALL mutable widget state is transferred to/from the browser for every callback. This isn't an issue with the simple example in Main.hs, but it might become an issue for larger widget hierarchies. * Only ONE client supported at a time. You read that right. Weird things will happen if you try to connect multiple clients. Immediate plans: * Find a better way to handle state transfer to lessen the burden of having to write JSON <-> JS and JSON <-> server-state translations by hand. I'm thinking that some of the ideas from the "Invertible Syntax" paper ( http://www.informatik.uni-marburg.de/~rendel/unparse/rendel10invertible.pdf ) may apply for this. Text.JSON.Generic may also be workable, but I had some trouble getting it to work with Text values and it doesn't help with generating the widget-specific JavaScript. * On a related note, I need a better way of generating JavaScript than string concatenation. Unfortunately, HJScript seems to be *too* strict about typing. * Expand the selection of widgets with more complex widgets so that I can get a feel for how the current Widget type class may need to be generalized/tweaked. Something requiring CSS would be good too, so I can hopefully get a basic theming mechanism down. * Get rid of the "one client only" limitation so that Dingo may actually become somewhat useful in practice. * A way of tracking client-side and server-side updates so that only things that have actually changed are transferred between client and server. For the server side this should be easy enough and for the client I'm thinking of something like attaching a "change()" event handler to all relevant DOM elements. Comments and suggestions appreciated. Cheers,