<div dir="ltr">Hi Shishir,<div><br></div><div>If you wrap multiline code in between </div><div><br></div><div><div>Prelude> :{</div><div>Prelude|      let main1 = do</div><div>Prelude|                    a <- getLine</div><div>Prelude|                    return a</div><div>Prelude| :}</div><div>Prelude> main1</div><div>hello</div><div>"hello"</div></div><div>It will work.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 8:45 PM, Shishir Srivastava <span dir="ltr"><<a href="mailto:shishir.srivastava@gmail.com" target="_blank">shishir.srivastava@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>I am trying to run this basic multiline code in GHCi. I am not sure if this is even possible without writing it in a file and compiling it in a traditional way. </div><div><br></div><div>-------</div><div><span style="font-family:monospace,monospace">Prelude> :set +m</span><br></div><div><div><font face="monospace, monospace">Prelude> let main1 = do</font></div><div><font face="monospace, monospace">Prelude|             a <- readLn</font></div><div><font face="monospace, monospace">Prelude|             return a</font></div><div><font face="monospace, monospace">Prelude|</font></div><div><font face="monospace, monospace">Prelude></font></div><div><font face="monospace, monospace">Prelude> main1</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><interactive>:75:1:</font></div><div><font face="monospace, monospace">    No instance for (Show (IO b0)) arising from a use of `print'</font></div><div><font face="monospace, monospace">    In the first argument of `print', namely `it'</font></div><div><font face="monospace, monospace">    In a stmt of an interactive GHCi command: print it</font></div></div><div>-------</div><div><br></div><div>Could someone please confirm if the function can be defined and called like this in GHCi or point to where am going wrong.</div><div><br></div><div>Thanks,</div><div><div><div><div dir="ltr"><font color="#0b5394"><font style="background-color:rgb(255,255,255)"><font size="2" face="georgia, serif">Shishir Srivastava</font></font><br></font><br></div></div></div>
</div></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>