re: [Haskell-cafe] Pure functional GUI (was "a regressive view of support for imperativeprogramming in Haskell")

As a newbie (okay I will not write this again, you all know I'm a newbie by now ;-), I don't understood what the problem of a pure functional GUI is. To me, having an imperative background, a graphical application is just a big tree of data that evolves when events from the OS come in. (this data is NOT per se the data for the GUI element; instead use the model-view-controller design pattern) In Haskell, instead of mutating the data (as done in C/C++), a infinite stream of this tree-data is generated responding to an infinite steam of events, as in Paul's SOE book (the reactive stuff). Since most of the data can be shared, the performance impact should be minimal. So could you please tell me more about the problem with pure functional GUIs and why this is not part of the Haskell library? I mean a GUI library completely written in Haskell, not wrapping a popular library. Thanks, Peter
----- Oorspronkelijk bericht ----- Van: Donn Cave [mailto:donn@drizzle.com] Verzonden: woensdag, augustus 8, 2007 08:56 PM Aan: haskell-cafe@haskell.org Onderwerp: Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell
On Wed, 8 Aug 2007, Paul Hudak wrote: ...
Well, you could argue, monad syntax is what really made Haskell become more accepted by the masses, and you may be right (although perhaps Simon's extraordinary performance at OSCOM is more of what we need). On the other hand, if we give imperative programmers the tools to do all the things they are used to doing in C++, then we will be depriving them of the joys of programming in the Functional Way. How many times have we seen responses to newbie posts along the lines of, "That's how you'd do it in C++, but in Haskell here's a better way...".
It seems to me that Brian Hulley threw the glove down hard. Does pure functional Haskell offer a better way to write a GUI?
I love the functional stuff myself, but if real applications depend on extensive imperative logic, we're best served by a language that cheerfully embraces the inevitable and handles it well. Monads, the do syntax, whatever it takes (I have a soft spot for O'Haskell, but alas I must be nearly alone on that.) Hopefully, it's still better, and not at all irreconcilable with the Functional Way.
Donn Cave, donn@drizzle.com
(That's a genuine question, by the way - my attempt to build a current Haskell GUI library on NetBSD foundered and I have no experience with Haskell GUI coding, but it's on the list of things I would like to look at. So if there's one that really illustrates the virtues of pure functional Haskell programming, that would be a welcome tip!)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Wed, 2007-08-08 at 19:14 +0000, Peter Verswyvelen wrote:
So could you please tell me more about the problem with pure functional GUIs and why this is not part of the Haskell library? I mean a GUI library completely written in Haskell, not wrapping a popular library.
Partly because just getting the drawing and interaction behaviour to be acceptable would be many person-years of work. GUI toolkits are not especially simple things. Even if you could do it in just 1/10th of the number of lines of code of Gtk+ or Qt it'd be a massive undertaking. Duncan

On Aug 8, 2007, at 3:14 PM, Peter Verswyvelen wrote:
So could you please tell me more about the problem with pure functional GUIs and why this is not part of the Haskell library? I mean a GUI library completely written in Haskell, not wrapping a popular library.
I had quite a lot of experience in pure functional GUI technology in developing the user-interface for the ICAD system -- a domain specific language for mechanical engineering. We developed another domain specific language for describing user-interface objects as a tree structure and implemented commands as applicative transactions using Zippers, though we called them path transactions. (Oh, did I mention this was in 1987?) Redisplay and undo of course were handled automatically. It was developed on Lisp Machines and then ported to X-Windows. I believe there are some nooks and crannies in the aircraft industry were it is still being used. There were some issues which time may have solved. 1.) Redisplay could be a little tedious due to slow video hardware. 2.) Locality became a problem with the shared data-structures being spread throughout memory. Thus performance could be adversely affected by paging. (In 1987, 8MBytes of Lisp Machine memory cost $10,000.) Issues that time won't solve. 1.) It was non-standard -- at the time that meant "not Motif." Does anybody remember Motif? 2.) It is a thankless task. Innovation is not welcomed. It's better left up to committees. I don't believe that there is any technical reason why something interesting couldn't be done. But if you actually want people to use your GUI tools, that is several orders of magnitude more work -- and not the most interesting kind. An interesting possibility that arises when coding has become so effortless as it now has in Haskell, is to create GUI technologies just for a single project. Encourage innovation and experimentation in usability with a captive audience. An example of this is the PureData computer music system. The user-interface is quite innovative and non-standard, but the users of the application have taken it to a cult status even though it's purposefully kind of ugly. http://puredata.info/ ___________________ (---o-------o-o-o---o-o-o----( David F. Place mailto:d@vidplace.com

FranTk, Haggis, Fudgets, Object I/O for Haskell, Gadgets, Pictures, HTk, Haskell Tk, HToolkit, Gtk+HS, Gtk2Hs, wxHaskell, FunctionalForms, .. and no, that list is not exhaustive by any means (you can find abstracts for some of these in old haskell community reports, but a lot of functional gui lib research pre-dates those reports). functional gui libs used to be one of the favourite haskell research excercises. some of those were low-level bindings, some were high-level declarative abstractions, but that wasn't the problem. the problem was that very nearly all of them came and went. the declared goal of the current generation was to provide more long-lived platforms, leaving most of the maintenance to others by binding directly to popular imperative libraries. it was always the intention that someone would build higher-level declarative approaches on top of those bindings. claus

Hello Peter, Wednesday, August 8, 2007, 11:14:37 PM, you wrote:
To me, having an imperative background, a graphical application is just a big tree of data that evolves when events from the OS come in. (this data is NOT per se the data for the GUI element; instead use the model-view-controller design pattern) In Haskell, instead of mutating the data (as done in C/C++), a infinite stream of this tree-data is generated responding to an infinite steam of events, as in Paul's SOE book (the reactive stuff). Since most of the data can be shared, the performance impact should be minimal.
So could you please tell me more about the problem with pure functional GUIs
seems that such program will have no effects :) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

LOL. Yeah you are correct I guess. Oh well ;-) -----Original Message----- From: Bulat Ziganshin [mailto:bulat.ziganshin@gmail.com] Sent: Thursday, August 09, 2007 7:30 AM To: Peter Verswyvelen Cc: Donn Cave; haskell-cafe@haskell.org Subject: Re[2]: [Haskell-cafe] Pure functional GUI (was "a regressive view of support for imperativeprogramming in Haskell") Hello Peter, Wednesday, August 8, 2007, 11:14:37 PM, you wrote:
To me, having an imperative background, a graphical application is just a big tree of data that evolves when events from the OS come in. (this data is NOT per se the data for the GUI element; instead use the model-view-controller design pattern) In Haskell, instead of mutating the data (as done in C/C++), a infinite stream of this tree-data is generated responding to an infinite steam of events, as in Paul's SOE book (the reactive stuff). Since most of the data can be shared, the performance impact should be minimal.
So could you please tell me more about the problem with pure functional GUIs
seems that such program will have no effects :) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On 8/8/07, Bulat Ziganshin
wrote: Hello Peter, Wednesday, August 8, 2007, 11:14:37 PM, you wrote:
[...] So could you please tell me more about the problem with pure functional GUIs
seems that such program will have no effects :)
Not necessarily. Just design the UI & IO aspects orthogonally. For instance, in the applicative functor version of Phooey ( http://haskell.org/haskellwiki/Phooey#Applicative_Functor), you can define a value of type UI (a -> IO ()). Similarly for TV ( http://haskell.org/haskellwiki/TV). - Conal
participants (7)
-
'Peter Verswyvelen'
-
Bulat Ziganshin
-
Claus Reinke
-
Conal Elliott
-
David F. Place
-
Duncan Coutts
-
Peter Verswyvelen