help with type error in a wxHaskell program

Hi: I'm new to Haskell and to wxHaskell (but found playing with wxHaskell to be a nice mid-ground between my years of imperative experience and the pure functional). Thanks for the help. I wrote the following code to create a set of staticText widgets by mapping the layout over a list. Easy enough... module Main where import Graphics.UI.WX main :: IO () main = start gui gui :: IO () gui = do f <- frame let s = map (\t -> staticText f [text := show t]) [1..10] set f [layout := margin 10 ( row 2 $ map (\x -> (widget x)) s)] But, I get a type error that I do not understand Couldn't match expected type ‘IO (Window a0)’ with actual type ‘[Prop (Frame ())] -> IO (Frame ())’ Probable cause: ‘frame’ is applied to too few arguments Thank you in advance, Jason

The type of frame according to the documentation is frame :: [Prop
http://hackage.haskell.org/package/wx-0.92.1.0/docs/Graphics-UI-WX-Attribute...
(Frame
http://hackage.haskell.org/package/wx-0.92.1.0/docs/Graphics-UI-WX-Frame.htm...
())] -> IO
http://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO (
Frame
http://hackage.haskell.org/package/wx-0.92.1.0/docs/Graphics-UI-WX-Frame.htm...
()). Maybe the documentation you are looking at is out of date?
On Sat, Nov 21, 2015 at 8:28 AM, Jason J. Corso
Hi:
I'm new to Haskell and to wxHaskell (but found playing with wxHaskell to be a nice mid-ground between my years of imperative experience and the pure functional). Thanks for the help.
I wrote the following code to create a set of staticText widgets by mapping the layout over a list. Easy enough...
module Main where import Graphics.UI.WX main :: IO () main = start gui gui :: IO () gui = do f <- frame let s = map (\t -> staticText f [text := show t]) [1..10] set f [layout := margin 10 ( row 2 $ map (\x -> (widget x)) s)]
But, I get a type error that I do not understand
Couldn't match expected type ‘IO (Window a0)’ with actual type ‘[Prop (Frame ())] -> IO (Frame ())’ Probable cause: ‘frame’ is applied to too few arguments
Thank you in advance, Jason _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

On Sat, Nov 21, 2015 at 8:28 PM, Jason J. Corso
But, I get a type error that I do not understand
Couldn't match expected type ‘IO (Window a0)’ with actual type ‘[Prop (Frame ())] -> IO (Frame ())’ Probable cause: ‘frame’ is applied to too few arguments
This is a consequence of the line "f <- frame" in gui :: IO () gui = do f <- frame let s = map (\t -> staticText f [text := show t]) [1..10] set f [layout := margin 10 ( row 2 $ map (\x -> (widget x)) s)] I have no experience at all with wxHaskell. But for the sake of forward motion, substituting with "f <- frame []" should work. -- Kim-Ee

Thank you both for the help. There was another mistake after this
piece. The let s = map... led to a [IO (StaticText())] and it had to
be changed as below. The below code works. Thanks again.
module Main where
import Graphics.UI.WX
main :: IO ()
main
= start gui
gui :: IO ()
gui = do
f <- frame [text := "First Fix!"]
ss <- mapM (\t -> staticText f [text := show t]) [1..10]
set f [layout := margin 10 ( row 2 $ map (\x -> (widget x)) ss)]
Jason
On Sat, Nov 21, 2015 at 10:52 PM, Kim-Ee Yeoh
On Sat, Nov 21, 2015 at 8:28 PM, Jason J. Corso
wrote: But, I get a type error that I do not understand
Couldn't match expected type ‘IO (Window a0)’ with actual type ‘[Prop (Frame ())] -> IO (Frame ())’ Probable cause: ‘frame’ is applied to too few arguments
This is a consequence of the line "f <- frame" in
gui :: IO () gui = do f <- frame let s = map (\t -> staticText f [text := show t]) [1..10] set f [layout := margin 10 ( row 2 $ map (\x -> (widget x)) s)]
I have no experience at all with wxHaskell. But for the sake of forward motion, substituting with "f <- frame []" should work.
-- Kim-Ee
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
participants (3)
-
David McBride
-
Jason J. Corso
-
Kim-Ee Yeoh