<div>Hello,</div>
<div> </div>
<div>what you suggested worked! Im very happy with it. However another error suddenly came up. It sais the last statement in a &#39;do&#39; must be an expression, he is refering to line 41:45</div>
<div> </div>
<div>I change my code to this:</div>
<div> </div>
<div>                    on (menu exit) := close f, <br>                    on (menu open) := onOpen f dt vFile ]<br> <br>            return ()<br>            <br>            where <br>                onOpen :: Frame a -&gt; staticText c -&gt; Var b -&gt; IO ()<br>
                onOpen frame stat var = do   file &lt;- fileOpenDialog frame False True &quot;Open File&quot; [(&quot;PGM bestanden (*.pgm)&quot;,[&quot;*.pgm&quot;]),(&quot;Alle bestanden (*.*)&quot;,[&quot;*.*&quot;])] &quot;&quot; &quot;&quot;<br>
                                        case file of<br>                                            Nothing -&gt;      return ()<br>                                            Just file -&gt;    set stat [text := &quot;HELLO&quot;]<br>
                                                            return ()</div>
<div> </div>
<div>As far as I can tell, if the file is nothing it will return something of IO () and if the file is something it will return something of IO (). So that error is kind of strange in my opinion. Do you know what caused it?</div>

<div> </div>
<div>Thanks for your help!<br><br></div>
<div class="gmail_quote">2009/4/17 Lennart Augustsson <span dir="ltr">&lt;<a href="mailto:lennart@augustsson.net">lennart@augustsson.net</a>&gt;</span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Take a look at the syntax for &#39;let&#39; inside a &#39;do&#39;.<br>
<div>
<div></div>
<div class="h5"><br>On Fri, Apr 17, 2009 at 12:57 AM, Tsunkiet Man &lt;<a href="mailto:temp.tsun@gmail.com">temp.tsun@gmail.com</a>&gt; wrote:<br>&gt; PS: a small note, sorry for multiple mails.<br>&gt;<br>&gt; After doing the let ... in function it did not work. =( It gave the error<br>
&gt; that &#39;do&#39; has to end with some result. I did:<br>&gt;<br>&gt; do let &lt;the function&gt; in &lt;all the code that was behind the do&gt;<br>&gt;<br>&gt; and it still didn&#39;t work =(. I&#39;m doing something wrong I think.<br>
&gt;<br>&gt; Thanks for your help.<br>&gt;<br>&gt; 2009/4/17 Tsunkiet Man &lt;<a href="mailto:temp.tsun@gmail.com">temp.tsun@gmail.com</a>&gt;<br>&gt;&gt;<br>&gt;&gt; Thank you for your response, however if I can&#39;t do that, why can the<br>
&gt;&gt; example of wxHaskell do that?<br>&gt;&gt;<br>&gt;&gt; I refer to the following code inside<br>&gt;&gt; <a href="http://darcs.haskell.org/wxhaskell/samples/wx/" target="_blank">http://darcs.haskell.org/wxhaskell/samples/wx/</a> (ImageViewer.hs)<br>
&gt;&gt;<br>&gt;&gt; Line 99 untill 110<br>&gt;&gt;<br>&gt;&gt;     openImage sw vbitmap mclose status fname<br>&gt;&gt;       = do -- load the new bitmap<br>&gt;&gt;            bm &lt;- bitmapCreateFromFile fname  -- can fail with exception<br>
&gt;&gt;            closeImage vbitmap<br>&gt;&gt;            set vbitmap [value := Just bm]<br>&gt;&gt;            set mclose [enabled := True]<br>&gt;&gt;            set status [text := fname]<br>&gt;&gt;            -- reset the scrollbars<br>
&gt;&gt;            bmsize &lt;- get bm size<br>&gt;&gt;            set sw [virtualSize := bmsize]<br>&gt;&gt;            repaint sw<br>&gt;&gt;        `catch` \err -&gt; repaint sw<br>&gt;&gt;<br>&gt;&gt; if I&#39;m correct the openImage is also defined in the where clause. Therefor<br>
&gt;&gt; by what I think it should not be possible, but it is.<br>&gt;&gt;<br>&gt;&gt; Thanks for everything.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; 2009/4/17 Lennart Augustsson &lt;<a href="mailto:lennart@augustsson.net">lennart@augustsson.net</a>&gt;<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt; Variables bound in the do block are not in scope in the where.<br>&gt;&gt;&gt; Use a let inside the do for onOpen instead.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; On Thu, Apr 16, 2009 at 11:53 PM, Tsunkiet Man &lt;<a href="mailto:temp.tsun@gmail.com">temp.tsun@gmail.com</a>&gt;<br>
&gt;&gt;&gt; wrote:<br>&gt;&gt;&gt; &gt; Hello,<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt; I&#39;m trying to create a GUI by using wxHaskell. However I get the weird<br>&gt;&gt;&gt; &gt; error<br>&gt;&gt;&gt; &gt; message of &quot;Not in scope &quot;dt&quot;&quot;, well so I sorted them so that my so<br>
&gt;&gt;&gt; &gt; called<br>&gt;&gt;&gt; &gt; &quot;dt&quot; was in scope, however it failed. Can someone please tell me how I<br>&gt;&gt;&gt; &gt; can<br>&gt;&gt;&gt; &gt; solve this error?<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;            ... A lot of code that is not relevant in my opinion, if I&#39;m<br>
&gt;&gt;&gt; &gt; wrong please correct me and I will post my full code<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;             --Debug text --<br>&gt;&gt;&gt; &gt;             dt &lt;- staticText f [text := &quot;Hello world!&quot;]<br>
&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;             imagePanel &lt;- panel f [position := Point 2 2, clientSize :=<br>&gt;&gt;&gt; &gt; Size<br>&gt;&gt;&gt; &gt; 100 100, tooltip := &quot;This is a drawPanel&quot;, bgcolor := rgb 255 255 255]<br>
&gt;&gt;&gt; &gt;             set f [ clientSize := Size 700 500,<br>&gt;&gt;&gt; &gt;                     menuBar := [mFile, mHelp],<br>&gt;&gt;&gt; &gt;                     visible := True,<br>&gt;&gt;&gt; &gt;                     on (menu exit) := close f,<br>
&gt;&gt;&gt; &gt;                     on (menu open) := onOpen f vFile ]<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;             return ()<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;             where<br>
&gt;&gt;&gt; &gt;                 onOpen :: Frame a -&gt; Var b -&gt; IO ()<br>&gt;&gt;&gt; &gt;                 onOpen frame var = do   file &lt;- fileOpenDialog frame<br>&gt;&gt;&gt; &gt; False<br>&gt;&gt;&gt; &gt; True &quot;Open File&quot; [(&quot;PGM bestanden (*.pgm)&quot;,[&quot;*.pgm&quot;]),(&quot;Alle bestanden<br>
&gt;&gt;&gt; &gt; (*.*)&quot;,[&quot;*.*&quot;])] &quot;&quot; &quot;&quot;<br>&gt;&gt;&gt; &gt;                                         case file of<br>&gt;&gt;&gt; &gt;                                             Nothing -&gt;      return ()<br>
&gt;&gt;&gt; &gt;                                             Just file -&gt;    set dt<br>&gt;&gt;&gt; &gt; [text :=<br>&gt;&gt;&gt; &gt; &quot;HELLO&quot;]<br>&gt;&gt;&gt; &gt;                                                             return ()<br>
&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt; Thank you for your help, I really owe haskell-cafe.<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt; Greetings Tsunkiet Man<br>&gt;&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt;&gt; &gt; Haskell-Cafe mailing list<br>&gt;&gt;&gt; &gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>&gt;&gt;&gt; &gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;<br>&gt;<br>&gt;<br></div></div></blockquote></div><br>