[Haskell-cafe] Newbie type question for wxHaskell learner
daniel.is.fischer at googlemail.com
Fri Jan 7 20:21:21 CET 2011
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.
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]))
mapM foo my_list
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)
What does the compiler say exactly?
More information about the Haskell-Cafe