On 15/08/07, <b class="gmail_sendername">Gregory Propf</b> <<a href="mailto:gregorypropf@yahoo.com">gregorypropf@yahoo.com</a>> wrote:<div><span class="gmail_quote"></span><div><br>----- Original Message ----<br>From: Jeff Polakow <
<a href="mailto:jeff.polakow@db.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">jeff.polakow@db.com</a>><br><br><tt><font size="2">One general intuition about monads is that they represent
computations rather than simple (already computed) values:</font></tt>
<br><span class="ad">
<br></span> I still want to re-iterate that they represent /complex/ computations - multiple, conditional results, extra stuff etc.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hence the need to perform a "run" operation like runIdentity, evalState or runParser (for Parsec) to get something useful to happen. Except for lists we don't seem to do this. I suppose lists are so simple that the operators :, ++ and
the [] constructor do all we ever need with them. Finally there is no runIO because "main" is essentially that function in every real program? - Greg</div></div></div></div></div></div></blockquote><div><br><br>
What the run functions do is unwrap the monad. They take apart the 'm a' and give you back whatever a's might be<br>inside, and whatever extra stuff too. (Also feeding extra stuff in when m is like that) Doing that will involve actually evaluating
<br>the value, forcing all the data dependencies and making the 'actions' happen.<br><br>If the monad type 'm a' is already a type we can take apart directly (list, maybe etc.) theres no need for a run function.
<br><br>Note that of course unsafePerformIO is runIO. Its just that it doesn't really nest safely, so we like to only<br>use the top level one from main.<br><br></div></div>-- <br>Brian_Brunswick____brian@ithil.org____Wit____Disclaimer____!Shortsig_rules!