[Haskell-beginners] Pb with toggleActionNew

Pierre Michallet p.michallet at free.fr
Sun Jul 22 16:46:56 CEST 2012


I am trying to become acquainted with both haskell and Gtk thru the writing of small pieces of code exercising some Gtk functions.
Having had problems with the ToggleEntry function (unable to get the checked/non checked status - refer to chapter 7.2 of the Gtk2HS tutorial) I have tried to understand
the toggleAction thing.
So I have written this :

import  Graphics.UI.Gtk.ActionMenuToolbar.ToggleAction
...

togls::[ToggleAction]
togls = let stone = toggleActionNew "STON" "Stones number" Nothing  Nothing  (myTog stone)       
               deste = toggleActionNew "DEST" "Destination" Nothing Nothing  (myTog deste)      
              state = toggleActionNew "STAT" "Board status" Nothing Nothing  (myTog state)
          in [stone,deste,state]

myTog::ToggleAction->IO()
myTog ta =  putStrLn ("The name of the action is " ++ (toggleActionName ta))   

The compiler is not happy with this and sends back the following:

-------------------------------------------------------------------------------------------------------------------------------------------

The function 'toggleActionNew' is applied to five arguments but its type 'String
                                                                                                      ->String
                                                                                                      ->Maybe String
                                                                                                      -> Maybe stockId
                                                                                                      ->IO ToggleAction
has only four.

-------------------------------------------------------------------------------------------------------------------------------------------
To me, stone has 4 parameters ("STON", "Stones number", Nothing,Nothing) and a result (myTog stone) as in the definition given by the compiler.
I am using ghc-7.0.3
                gthk+-bundle_2.16.2-20090601_win32
                gtk-0.12.3.1 documentation

I am certainly missing something obvious to everybody but I could not solve it , so I would appreciate any help on this topic.

Thanks in advance

p.michallet at free.fr
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120722/cb072eb2/attachment.htm>


More information about the Beginners mailing list