Functional Reactive GUI for O'Caml
Since functional reactive programming has come up here a few times in the past, I figured my posting of this wouldn't be too out-of-place...
I've been working for the past few months on a functional reactive GUI system for O'Caml called "O'Caml Reactive Toolkit". The core FR logic is based heavily on Haskell's Yampa, while the FR API is modelled after PLT Scheme's FrTime (users of FrTime should feel at home with the API), so there is not much new there. The novelty is in the GUI API, which constructs a GUI via functions, in contrast to systems such as Fudgets (which uses arrows), or SuperGlue (which uses objects with explicit signal connections). The goal in API design is simplicity and clarity. As an example, here is a toy temperature conversion program:
open Fr open FrGui let _ = let temp_box, temp = float_entry 20. in let fahrenheit = lift ((@temp -. 32.) *. 1.8) and celsuis = lift (@temp /. 1.8 +. 32.) in let main_window = window ~title: "Temperature converter" (hbox [ hbox [label "Convert "; temp_box; label " to:"]; vbox [ hbox [label "degrees Fahrenheit: "; float_view fahrenheit]; hbox [label "degrees Celsius: "; float_view celsius]]]) in run_dialog (main_window, main_window#close)
The temperature entered by the user is instantly converted to both degrees Fahrenheit and degrees Celsius. (Note the definitions of "float_entry" and "float_view", although trivial, have been left out to save space.)
Though O'Caml RT is far from complete I made a prerelease because I want to solicit feedback from others who are interested in functional reactive programming. I made a web page providing links to the source code, documentation, and (coming soon) examples. It's known to compile on Mac OS X and Linux, and it should be possible already to write many simple GUI applications using it.
My questions to you are:
Thanks in advance for your feedback!
(P.S. I don't want this to come off as a plug for O'Caml RT... if any of the admins feel this is too specific a topic for LtU I'll try to find a more appropriate forum to discuss it in.)
Active forum topics
New forum topics