Re[2]: [Haskell-cafe] Network of GUI Controls - using MonadFix?

2010-06-24 Thread Bulat Ziganshin
Hello Felipe,

Thursday, June 24, 2010, 5:00:55 AM, you wrote:

 Is that something that MonadFix is meant to be used for?

 In current Gtk libraries, no.  You'll do something like
 However, if some library required you to supply the action while
 constructing the button, then I guess the answer would be yes.

he may have his own high-level abstractions that combine create and
connect, in this case the answer is yes:

rdo btn1 - createAndConnectBtn btn2
btn2 - createAndConnectBtn btn3
btn3 - createAndConnectBtn btn1


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Network of GUI Controls - using MonadFix?

2010-06-23 Thread Günther Schmidt

Hello list,

let's say I would like to create 4 buttons where any one button can 
respond to a click and notify every other button.
Ie. where the 1st button is wired with the 2nd, the 2nd with the 3rd ... 
and the 4th button with the 1st.


In short I would like these buttons to be connected as in a cyclic list.

Is that something that MonadFix is meant to be used for?

Günther


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Network of GUI Controls - using MonadFix?

2010-06-23 Thread Felipe Lessa
On Thu, Jun 24, 2010 at 02:35:55AM +0200, Günther Schmidt wrote:
 Is that something that MonadFix is meant to be used for?

In current Gtk libraries, no.  You'll do something like

  do btns - mapM createBtn [1..4]
 mapM_ connect $ zip btns (tail $ cycle btns)

However, if some library required you to supply the action while
constructing the button, then I guess the answer would be yes.

Cheers,

--
Felipe.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe