<br><br><div class="gmail_quote">On Thu, Feb 5, 2009 at 2:38 PM, Jonathan Cast <span dir="ltr"><<a href="mailto:jonathanccast@fastmail.fm">jonathanccast@fastmail.fm</a>></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 13:01 -0800, David Leimbach wrote:<br>
><br>
><br>
> On Thu, Feb 5, 2009 at 12:27 PM, Jonathan Cast<br>
> <<a href="mailto:jonathanccast@fastmail.fm">jonathanccast@fastmail.fm</a>> wrote:<br>
><br>
> On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote:<br>
> ><br>
> ><br>
> > On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner<br>
> > <<a href="mailto:wagner.andrew@gmail.com">wagner.andrew@gmail.com</a>> wrote:<br>
> > I think the point of the Monad is<br>
> that it<br>
> > works as a container of stuff, that<br>
> still<br>
> > allows mathematically pure things to<br>
> happen,<br>
> > while possibly having some opaque<br>
> "other<br>
> > stuff" going on.<br>
><br>
> > This at least sounds, very wrong, even if it's not.<br>
> Monads<br>
> > are not impure. IO is, but it's only _one_ instance<br>
> of Monad.<br>
> > All others, as far as I know, are pure. It's just<br>
> that the<br>
> > bind operation allows you to hide the stuff you<br>
> don't want to<br>
> > have to worry about, that should happen every time<br>
> you compose<br>
> > two monadic actions.<br>
<br>
> > Well all I can tell you is that I can have (IO Int) in a<br>
> function as a<br>
> > return, and the function is not idempotent in terms of the<br>
> "stuff"<br>
> > inside IO being the same.<br>
><br>
><br>
> Sure it's the same.<br>
><br>
> > cmp /bin/cat /bin/cat<br>
> > cp /bin/cat ~<br>
> > cmp /bin/cat ~/cat<br>
> ><br>
><br>
> Pretty much the same, anyway.<br>
<br>
</div></div><div class="Ih2E3d">> So if IO represents a program that when executed interacts with the<br>
> world's state, is it safe to say that when I return (State Int Int),<br>
> that I'm returning a "State program"?<br>
<br>
</div>I won't object to it. Othe people might, though.<br>
<div class="Ih2E3d"><br>
> That'd make sense as it really does look like we force the State to be<br>
> evaluated with runState, evalState or execState.<br>
<br>
> The only difference with IO then is that to get IO programs to run,<br>
> you have to do it inside another IO program.<br>
<br>
</div>Meh. Combining IO sub-programs into larger programs doesn't really `get<br>
them to run'. Better to say that an IO value is meaningful only to the<br>
computer, and not mathematically (denotationally) useful.<br>
<br>
jcc<br></blockquote><div><br></div><div>All Haskell programs start as </div><div><br></div><div>main :: IO ()</div><div><br></div><div>though... so they all get evaluated in the context of another IO () don't they?</div>
<div><br></div><div><br></div><div> </div></div><br><div><br></div>