[Haskell-cafe] wxHaskell: convenience functions

Mark Carter mcturra2000 at yahoo.co.uk
Fri Sep 16 13:13:42 EDT 2005

I'm experimenting with wxHaskell, and I've got something like:

main = run mainFrame

mainFrame = do -- main application frame
    cbEdit <- checkBox p1 [text := "Edit Mode",  on command ::=  
onCbEdit textlog]

It would be useful to have some convenience function, let's say, 
isEditing, which works out whether cbEdit is checked, or not. That way, 
one could just pass this in as a parameter without requiring any extra 
code. The problem is, I can't see how it can be done. I've tried various 
things in the main section, and nothing worked. I tried putting the 
following defintion into the where clause:

    isEditing = do
        checkedp <- get cbEdit checked
        return checkedp

but the compiler complained that cbEdit is not in scope. I /could/ pass 
in cbEdit as a parameter to isEditing, but I'd rather not.

To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

More information about the Haskell-Cafe mailing list