<div dir="ltr">Haskell is impure only when you use the unsafe* functions (atleast that's how I understand purity).<div><br></div><div>My understanding is that a language is impure if it allows one to write arbitrary IO within a function and still give it a proper (mathematical) function type. In other words impurity arises only if you can unwrap the IO monad (which is what the unsafe functions do).</div><div><br></div><div>The two examples you give above are pure under such a perspective, but I might be wrong.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 March 2015 at 23:19,  <span dir="ltr"><<a href="mailto:amindfv@gmail.com" target="_blank">amindfv@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="auto"><div>From that perspective isn't every language pure? Haskell's still got "randomIO" and "print <=< readMVar"</div><div><br></div><div>Tom</div><div><br></div><div><br>El Mar 15, 2015, a las 13:15, "Sumit Sahrawat, Maths & Computing, IIT (BHU)" <<a href="mailto:sumit.sahrawat.apm13@iitbhu.ac.in" target="_blank">sumit.sahrawat.apm13@iitbhu.ac.in</a>> escribió:<br><br></div><div><div class="h5"><div><span></span></div><blockquote type="cite"><div><div dir="ltr"><div>Hello Simon,</div><div><br></div>If you changed your perspective, you would realize that all functions in haskell are pure.<div>A function is pure if it returns the same output if given the same input. Every monadic function (including functions returning IO) is also pure.</div><div>For example,</div><div><br></div><div><font face="monospace, monospace">    putStrLn :: String -> IO ()</font></div><div><font face="monospace, monospace">    -- A function that takes a string, and returns an impure computation</font></div><div><font face="monospace, monospace">    -- which, when executed will print the given String.</font></div><div><font face="monospace, monospace"><br></font></div>For any string, putStrLn applied to that same string always describes the same impure computation, thus the function is actually pure.<div>I am not familiar with any other functional language, but there are not many purely functional ones out there [1].</div><div>I guess the impure ones get around this issue by giving in to impurity, but I'm not sure.</div><div><br></div><div>I'll be interested in hearing more about the other languages too.</div><div><br></div><div>[1] : <a href="http://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Pure" target="_blank">http://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Pure</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 March 2015 at 22:25, Marcin Mrotek <span dir="ltr"><<a href="mailto:marcin.jan.mrotek@gmail.com" target="_blank">marcin.jan.mrotek@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
F* uses a somewhat similar approach: <a href="https://fstar-lang.org/tutorial/" target="_blank">https://fstar-lang.org/tutorial/</a><br>
(section 2, Types and Effects)<br>
<br>
Best regards,<br>
Marcin Mrotek<br>
<div><div>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Beginners mailing list</span><br><span><a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a></span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a></span><br></div></blockquote></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div>