Functional Reactive Web Application Framework?

Hi, I've been learning Haskell for a few months, and it has influenced my thinking about programs quite a lot. Most of my current work is creating complex web applications. Naturally, I was thinking about how to make rich internet applications (and GUI apps in general) in an (utmost :-)) functional way. Recently I found out the concepts of functional reactive programming http://www.haskell.org/haskellwiki/Functional_Reactive_Programming, which supersede and generalize my ideas. My question is: "Is there a FRP web application framework, or perhaps an effort to create one?" If not, I'd be willing to start such a project, but since I'm not very experienced Haskell programmer, I'd most likely need some help from somebody more experienced. If somebody would be interested, my ideas go as follows: Handling events in GUI/RIA applications can be very tedious, especially for complex applications. Instead, I'd prefer something like that: 1) Abstract what a user wants to see using a structured datatype, specifically tailored for the application. You may imagine it as something like a structured URL. This can be then viewed as a FRP behavior -- a function of the user's request depending on time. 2) The data that will be displayed on the page are a function of this structured user request and an environment, which is usually database. This is again a behavior. 3) Finally, the resulting page is a function of the data (again a behavior). 4) User actions that change the application state (update the database) could be viewed as FRP events. So instead of handling tons of events, the programmer would construct the application mostly by composing behaviors. Only state-changing user actions would be handled as events. Does anybody see these ideas as useful? Constructive criticism is welcomed. Best regards, Petr

The only web-oriented frp framework that I know of is Flapjax http://www.flapjax-lang.org/ Flapjax is javascript so possibly there could be a way to integrate it into Haskell using HJavascript? Maybe it could even be integrated into Happstack? I'm also quite new to Haskell. -Rob

2009/5/13 Robert Wills
The only web-oriented frp framework that I know of is Flapjax http://www.flapjax-lang.org/
Flapjax is javascript so possibly there could be a way to integrate it into Haskell using HJavascript? Maybe it could even be integrated into Happstack?
I'm also quite new to Haskell.
-Rob _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
There is this link posted on reddit... http://ambassadortothecomputers.blogspot.com/2009/04/functional-reactive-aja... http://www.reddit.com/r/programming/comments/8jqgn/monadic_functional_reacti... Cheers, Thu

Flapjax is javascript so possibly there could be a way to integrate it into Haskell using HJavascript? Maybe it could even be integrated into Happstack?
The Flapjax compiler is written in Haskell, so that might help. I assume you want to write FRP in a Haskell-embedded DSL and generate FRP'd JavaScript. If you wish to use Flapjax as a supporting library I'd be glad to help. Arjun

I assume you want to write FRP in a Haskell-embedded DSL and generate FRP'd JavaScript. If you wish to use Flapjax as a supporting library I'd be glad to help.
I'm curious: how difficult is it nowadays for in-page JavaScript to control the evolution of its surrouding page, FRP-style? I used to do something like that, but with VRML+JavaScript instead of HTML +JavaScript (there's a screencast for those without VRML viewer;-): http://community.haskell.org/~claus/FunWorlds/VRML/ and I found that mapping FRP style behaviours and events wasn't the problem (though VRML has better support for this than HTML), the problem was gaining the same advantages one would have from embedding FRP in a functional language. Problems included scoping, linking dynamically created material with enclosing scope (JavaScript being in strings with scopes separate from the enclosing VRML, VRML to be created dynamically also via strings, also in their own scope)

On Wed, May 13, 2009 at 06:46:45AM -0400, Arjun Guha wrote:
Flapjax is javascript so possibly there could be a way to integrate it into Haskell using HJavascript? Maybe it could even be integrated into Happstack?
The Flapjax compiler is written in Haskell, so that might help.
I assume you want to write FRP in a Haskell-embedded DSL and generate FRP'd JavaScript. If you wish to use Flapjax as a supporting library I'd be glad to help.
Arjun
Actually, I wanted to use Flapjax as the base for client-side programming. I didn't think about combining Flapjax with HJavaScript, this is quite a good idea. However, this would is just one part of what I'd like to have. No doubt many things can be done on the client, but more serious work or database operations must be done on the server anyway. Ideally, I'd like to spare a programmer from: * Working with HTML (unless explicitly desired); Instead, I'd prefer to compose the pages from components, either predefined or user-defined. This could be done for example using DSL in Haskell. The components could be both lightweight (almost HTML), or heavyweight like "menu", "toolbar" etc. * Transferring data between a server/client. Especially using FRP, this might be done very neatly I suppose. An event stream or a behavior could be transferred seamlessly by the framework from the client to the server and vice versa. The programmer would only see behaviors on either side. I've been working with the ZK framework http://zkoss.org/ lately, and it has many nice features. For example, composing pages from high-level components, the possibility to separate the layout of the pages form the controlling code, or sparing a programmer from working with HTML and HTTP requests - everything is done just by manipulating component objects and handling events. However, it's not functional at all. I believe FRP would be much better solution than classical event handling. And secondly, it's in Java, which is nothing bad (actually my code is in Scala), just it's not Haskell. Happsstack looks good, though I didn't have time to study it. Thanks for the links for OCAML JavaScript FRP, it looks iteresting too. Petr

wrwills:
The only web-oriented frp framework that I know of is Flapjax http://www.flapjax-lang.org/
Flapjax is javascript so possibly there could be a way to integrate it into Haskell using HJavascript? Maybe it could even be integrated into Happstack?
I'm also quite new to Haskell.
Isn't the flapjax compiler implemented in Haskell? -- Don

Yes, I didn't realise that until Arjun mentioned that. I'm going to
try to find some time to look more closely at Flapjax...
-Rob
On Wed, May 13, 2009 at 11:30 PM, Don Stewart
wrwills:
The only web-oriented frp framework that I know of is Flapjax http://www.flapjax-lang.org/
Flapjax is javascript so possibly there could be a way to integrate it into Haskell using HJavascript? Maybe it could even be integrated into Happstack?
I'm also quite new to Haskell.
Isn't the flapjax compiler implemented in Haskell?
-- Don
participants (6)
-
Arjun Guha
-
Claus Reinke
-
Don Stewart
-
minh thu
-
Petr Pudlak
-
Robert Wills