Re: [Haskell-cafe] wxHaskell: convenience functions

Actually, I can see how my requirement of not wanting to pass in cbEdit might not be so good. From an FP point of view, that's just asking for trouble. A better solution would appear to be to put the cbEdit in as a parameter, and just face the fact that all callers will be required to pass an extra parameter.

Mark Carter wrote:

>
>
> 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]
>    ...
>  where
>    ...
>
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



        
        
                
___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to