views:

306

answers:

2

Is there, by chance, an emerging Haskell UI framework for Windows?

I recently took up looking over the language, and from what I see, it would be for great little "one-off" applications (elaborate scripts).

However, without a good UI framework I can't see it getting in under the smoke and mirrors of the more obvious contenders.

I've read that there are many frameworks, but none are full-featured.

I'm just wondering if this is something that's on the rise, or is it simply too difficult to get enough developers going in the same direction with one?

+8  A: 

The two main frameworks are wxHaskell and Gtk2Hs. Both of these have been used for real work. From what I know my preference would be Gtk2Hs because it handles resources properly (i.e. uses the GC). wxHaskell requires the programmer to release widgets once they are no longer required, so you can get all the classic memory leaks and stale pointer screws with it.

The problem with both is that everything is in the IO monad. This reflects the fact that they are comparatively thin wrappers around existing GUI libraries for imperative languages. Of course this means you are no worse off than you would be writing a GUI in an imperative language, but you are hardly much better off either.

There are some interesting experimental libraries to be found on Hackage, including Grapefruit and Conal Elliot's "Tangible Values" ideas in GuiTV. Both of these try for a more declarative approach.

Paul Johnson
Thanks a ton! This is exactly the information I was looking for. I agree about the wrapper libraries though. Do you know of any applications that are written with Grapefruit, and/or how vast its adoption in the community is?
Lance May
@Lance, sorry, that's all I know.
Paul Johnson
See also http://stackoverflow.com/questions/2672791/is-functional-gui-programming-possible
eman
+3  A: 

(Disclaimer: I am the wxHaskell maintainer)

Both wxHaskell and Gtk2Hs are more or less complete. That's to say, both wrap a great deal of the functionality provided by their underlying libraries. They also both, as mentioned earlier, require a rather 'imperative' style of programming in the IO monad.

There have been many discussions on the relative merits of each. I would say that wxHaskell is the easier of the two to get working, especially on Windows, as it can be installed via cabal (see http://www.haskell.org/haskellwiki/WxHaskell/Install#On_Windows)

The FRP frameworks (Grapefruit and others) provide a more 'functional' style of programming, at the cost of having much reduced widget coverage. I have the feeling that this is still an open research area, and not really ready for 'prime time'.

In practice, I've never had resource management issues with wxHaskell, although I agree that it's possible, and is an area handled better by Gtk2Hs, which uses reference counting in the underlying library.

For completeness, I should also mention that a Qt binding (QtHaskell?) also exists - it is relatively young, but apparently reasonably complete.

I rather feel that the Haskell community, small as it is, would do well to fix on one GUI framework, but accept the difficulty of this (e.g. licensing, support for all OS platforms etc.).

Jeremy O'Donoghue