<br><br><div class="gmail_quote">On Thu, Feb 5, 2009 at 12:27 PM, Jonathan Cast <span dir="ltr">&lt;<a href="mailto:jonathanccast@fastmail.fm">jonathanccast@fastmail.fm</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="Wj3C7c">On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner<br>
&gt; &lt;<a href="mailto:wagner.andrew@gmail.com">wagner.andrew@gmail.com</a>&gt; wrote:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; I think the point of the Monad is that it<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; works as a container of stuff, that still<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; allows mathematically pure things to happen,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while possibly having some opaque &quot;other<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stuff&quot; going on.<br>
<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;This at least sounds, very wrong, even if it&#39;s not. Monads<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; are not impure. IO is, but it&#39;s only _one_ instance of Monad.<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; All others, as far as I know, are pure. It&#39;s just that the<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; bind operation allows you to hide the stuff you don&#39;t want to<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; have to worry about, that should happen every time you compose<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; two monadic actions.<br>
<br>
<br>
&gt; Well all I can tell you is that I can have (IO Int) in a function as a<br>
&gt; return, and the function is not idempotent in terms of the &quot;stuff&quot;<br>
&gt; inside IO being the same.<br>
<br>
</div></div>Sure it&#39;s the same.<br>
<br>
&gt; &nbsp;cmp /bin/cat /bin/cat<br>
&gt; cp /bin/cat ~<br>
&gt; cmp /bin/cat ~/cat<br>
&gt;<br>
<br>
Pretty much the same, anyway.<br>
<br>
jcc<br>
<br></blockquote><div><br></div><div>So if IO represents a program that when executed interacts with the world&#39;s state, is it safe to say that when I return (State Int Int), that I&#39;m returning a &quot;State program&quot;? &nbsp;That&#39;d make sense as it really does look like we force the State to be evaluated with runState, evalState or execState.</div>
<div><br></div><div>The only difference with IO then is that to get IO programs to run, you have to do it inside another IO program.</div><div><br></div><div>I hope I&#39;m not making this worse! :-)&nbsp;</div></div><br>