[Haskell-cafe] Pure functional GUI (was

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Aug 9 01:43:41 EDT 2007

Hello Hugh,

Thursday, August 9, 2007, 4:59:04 AM, you wrote:

>  How easy is gtk to use from haskell by the way?  In gc'd
> imperative languages, typically only one thread is allowed to
> communicate with the GUI, and you need to set up a whole bunch of
> message-parsing stuff to communicate with other threads.  To what
> extent is this easier in Haskell? 

you can just send actions to the GUI thread :) something like this:

main = do c <- newChan
          getChanContents c >>= forkOS . guiThread
          for [1..10] $ \i -> do
              writeChan c (print i)

guiThread (a:actions) = do a
                           guiThread actions

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list