
Yes you're right I had brackets wrong (and the 'where' version is easier to read), thanks. I think the where style works best - or maybe flip and a dangling \x-
.
I maybe slow but I'm learning.
N
On Jan 7, 7:21 pm, Daniel Fischer
On Friday 07 January 2011 19:45:26, b1g3ar5 wrote:
Nearly - the first suggestion doesn't work because each es needs a new panel I can't use the same one each time.
The second suggestion doesn't quite work because the x in [text := contents x] is not in scope of the \p function.
Hmm,
Prelude Graphics.UI.WX> :t \w -> mapM (\x -> panel w [] >>= \p -> textCtrl p [text := x]) \w -> mapM (\x -> panel w [] >>= \p -> textCtrl p [text := x]) :: Window a -> [String] -> IO [TextCtrl ()]
x is in scope as far as I can tell, the mapM'd lambda is
mapM (\x -> (panel nb [] >>= \p -> textCtrl p [text := contents x])) my_list
or
mapM foo my_list where foo x = do p <- panel nb [] textCtrl p [text := contents x]
x is bound in a scope enclosing p's scope, so it is (or should be) available.
What does the compiler say exactly?
_______________________________________________ Haskell-Cafe mailing list Haskell-C...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe