<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 26, 2015 at 4:59 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>For e.g. the <font face="monospace, monospace">getLine </font>function has the type <font face="monospace, monospace">IOString </font><font face="arial, helvetica, sans-serif">and it reads the input from the user. Now as I see it the output of getLine will always be same if the input remain same (i.e. for input "X" </font><font face="monospace, monospace">getLine </font><font face="arial, helvetica, sans-serif">will always return "X" ) which is the constraint on mathematical functions.</font></div></blockquote></div><br></div><div class="gmail_extra">Notice that getLine is not a function. It is a value of type IO String.<br><br></div><div class="gmail_extra">In the misty dawn of Haskell, how you'd achieve the same thing as getLine is to actually use Dialogue functions.<br><br>And yes, a value of type Dialogue is a bona fide function because Dialogue is a type synonym for [Response] -> [Request].<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">You can read a bit about Haskell 1.2 and IO here:<br><br><a href="http://r6.ca/blog/20110520T220201Z.html">http://r6.ca/blog/20110520T220201Z.html</a><br><br></div><div class="gmail_extra">Now Haskell 1.2 dates from 1992. Certainly it would be an experience playing with it. Unfortunately, I know of no way to get hold of a compiler or interpreter that old. You might want to query haskell-cafe.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Returning to getLine and monadic I/O, a question to contemplate is: how is getLine different from an ordinary String, say "hello world"?<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">-- Kim-Ee</div></div>
</div></div>