Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell UI framework?

Tags:

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?

like image 654
Lance Avatar asked May 18 '10 20:05

Lance


Video Answer


2 Answers

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 Elliott's "Tangible Values" ideas in GuiTV. Both of these try for a more declarative approach.

like image 182
Paul Johnson Avatar answered Mar 29 '23 17:03

Paul Johnson


(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.).

like image 37
Jeremy O'Donoghue Avatar answered Mar 29 '23 18:03

Jeremy O'Donoghue