[Haskell-cafe] do construct in wxhaskell

2008-04-12 Thread Jodi-Ann Prince

hi, im working ona project, and im having problem loading some code in 
wxhaskell:
 
 
onOpen :: Frame a - TextCtrl b - MenuItem c - StatusField - IO ()
onOpen f sw mclose status = do   mbfname - fileOpenDialog f False True Open 
image fileTypescase  
(mbfname) of  (Nothing)  - 
return ()
  (Just (fname)) - do   
fileContent - readFile fname
 
set sw [text := fileContent]
 set mclose [enabled := True]   
   set status [text := fname]   
   return ()
 
i keep getting the error : the last statement in a 'do' construct must be an 
expression.
ive tried rearranging it many times, but i still get the same error. any help 
would be greatly appreciated.
_
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=wlmailtagline___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] do construct in wxhaskell

2008-04-12 Thread Abhay Parvate
The indentation is not right; all the statements after the 'do' keyword need
to start exactly at the same column. In particular, the 'f' in fileContent
and 's' in set should be one below the other. And the 'return ()' also seems
to be displaced; perhaps you want that also exactly below the last 'set' if
it's the part of the last case.

Hope it helps
Abhay

2008/4/12 Jodi-Ann Prince [EMAIL PROTECTED]:

  hi, im working ona project, and im having problem loading some code in
 wxhaskell:


 onOpen :: Frame a - TextCtrl b - MenuItem c - StatusField - IO ()
 onOpen f sw mclose status = do   mbfname - fileOpenDialog f False True
 Open image fileTypes  
   case  (mbfname) of
   (Nothing)  - return ()
   (Just (fname)) - do
 fileContent - readFile fname

 set sw [text := fileContent]

 set mclose [enabled := True]

 set status [text := fname]
   return ()

 i keep getting the error : the last statement in a 'do' construct must be
 an expression.
 ive tried rearranging it many times, but i still get the same error. any
 help would be greatly appreciated.

 --
 Connect to the next generation of MSN Messenger  Get it now!
 http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=wlmailtagline

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe