[Haskell-beginners] Count how often a menu has been selected

Bernhard Lehnert b.lehnert at gmx.de
Sat Jul 25 07:10:02 EDT 2009


Hi list,

using gtk2hs I would like to count how often a Menu has been selected
(well, not really, but it kind of breaks down to this):


    let a = 0
    onActivateLeaf menuAddOne $ do
        let a = a+1
        print a


This leads to a stack overflow. Obviously a=a+1 is iterated over and
over again. But how can I add something each time the menu is activated?
(Actually I want to open a FileDialog and add the contents of a file to
a list but for now, counting would be great).

Thanks to everyone for reading,
Bernhard





More information about the Beginners mailing list