<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 8, 2013 at 11:05 PM, Tom Ellis <span dir="ltr">&lt;<a href="mailto:tom-lists-haskell-cafe-2013@jaguarpaw.co.uk" target="_blank">tom-lists-haskell-cafe-2013@jaguarpaw.co.uk</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote:<br>
&gt; &gt;One could simply implement IO as a free monad<br>
&gt; Interesting. I wonder how.<br>
<br>
</div>See [1] for an explanation of free monads in general.  For IO in particular,<br>
define a functor<br>
<br>
    data IOF a = GetChar (Char -&gt; a) | PutChar Char a | ...<br>
<br>
with constructors for all elementary IO operations.</blockquote></div><br></div><div class="gmail_extra">If I understand correctly, you&#39;re proposing equality of (IO a) based on the AST of imperatives, similar to what comes out of GCC&#39;s front-end for C [1].<br>

<br></div><div class="gmail_extra">In what way is this syntactical equality &quot;reasonable&quot;? Useful perhaps for detecting C&amp;P coding from befuddled undergrads?<br></div><div class="gmail_extra"><br>[1] <a href="http://digitocero.com/es/blog/exportar-y-visualizar-el-arbol-sintactico-abstractoast-de-gcc">http://digitocero.com/es/blog/exportar-y-visualizar-el-arbol-sintactico-abstractoast-de-gcc</a><br>

</div><div class="gmail_extra"><br clear="all"><div>-- Kim-Ee</div>
</div></div>