[Haskell-cafe] wxHaskell and do statements

mempko mempko at gmail.com
Mon Nov 28 08:30:01 EST 2005

Hello, I have a program that just will not compile and I cannot figure 
out why. I am starting out with wxHaskell but keep getting certain 
errors. Here is the source:

module Main where

import Graphics.UI.WX

main :: IO ()
main = start hello

hello :: IO ()
hello = do f <- frame [text := "Super Window"]
		lab <- staticText f [text:= "Hello"]
		quit <- button f [text:= "Quit", on command := close f]
		touch <- button f [text:= "Touch Me",
				on command := set quit [text:= "Yay"]]
		set f [layout:= floatCenter (widget lab) $
				floatCenter (widget touch) $
				floatCenter (widget quit)]

I keep the following error

Compiling Main             ( test1.hs, test1.o )

test1.hs:9:11: The last statement in a 'do' construct must be an expression

I looked at source code for the do statement and can not understand why 
I get that error.

More information about the Haskell-Cafe mailing list