tags:

views:

316

answers:

1

There has been a lot of research into ways of creating guis in a functional language. There is libraries for push/pull frp, arrow based frp and probably other superior research too. Many people seem to agree this is the more native way yet just about everyone seems to be using imperative binding libraries such as gtk2hs and wxhaskell. Even places recommended as good tutorials teach binding to these plain imperative libraries. Why not guis based on FRP research?

+12  A: 

While everyone agrees that functional reactive programming (FRP) is the way to go for implementing graphical user interface, no well-rounded library for doing so in Haskell has emerged yet. I think the main reasons are:

  • Balancing expressivity VS resource usage is difficult (space leaks, timing issues). The more expressive your FRP model, the harder it is to implement it while still guaranteeing efficiency. The design space is still being explored.
  • API convenience. FRP is well-suited for implementing functions of the form Time -> MouseInput -> Picture, but GUI platforms like GTK+ or Cocoa don't work like that, and the question is how to express the latter in FRP style without getting more complicated than the traditional style.

In other words, FRP research is not yet complete.

That being said, some practical implementations already exist, for instance Flapjax, a language that compiles to JavaScript.

In any case, nobody can stop you from implementing your own FRP library tailored for a particular purpose and greatly profit from that. Luke Palmer has done so successfully, and I'm currently trying that as well. (I'd rather waste my time with FRP than with mutable variables.)

Heinrich Apfelmus