On Sun, Feb 8, 2009 at 6:39 PM, Richard O&#39;Keefe <span dir="ltr">&lt;<a href="mailto:ok@cs.otago.ac.nz">ok@cs.otago.ac.nz</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
is a good one. &nbsp;If you want to say that &quot;a mathematical value with<br>
a non-mathematical effect&quot; is nonsensical, more power to you. &nbsp;I said<br>
I don&#39;t want to get far into White Knight territory. &nbsp;As long as you<br>
can agree &quot;A mathematical value INTERPRETED BY a physical engine can<br>
have physical effects&quot;, we&#39;re home and dry.<br>
</blockquote><div><br>Here&#39;s an analogy that will make the logical contradiction clear.&nbsp; Forget computers and assume you have been asked to referee a paper containing a proof with the following passage:<br><br>&nbsp;&nbsp; Let x = ___ (Please fill in the blank)<br>
<br>I think you will agree that would be plainly nonsensical.&nbsp; It&#39;s logically equivalent to an input operation (&quot;getInt&quot;).<br><br>Now back to computers.&nbsp; Given a program text containing the symbol &#39;3&#39;, the computer will provide a physical representation: an electromagnetic pattern in a bit of silicon.&nbsp; That&#39;s a value; the pattern is to be interpreted as a datum; it is not to be executed.&nbsp; For &quot;getChar&quot;, the computer will also provide such a pattern, but this pattern is to be interpreted as executable code, not as a datum.&nbsp; Now suppose we also have an ordinary function like &quot;Add2&quot;; it too will be represented as an electromagnetic pattern, to be interpreted as executable code.&nbsp; getChar and Add2 are not data, except in the trivial sense that all code is data.&nbsp; All three &quot;have an effect&quot; only in the trivial sense that they are physically represented.<br>
<br>In all three cases, the symbolic representation is isomorphic to the physical representation.&nbsp; The 3 will not be executed.&nbsp; When Add2 is executed, the ensuing process is isomorphic to the mathematical function so defined.&nbsp; But when getChar is executed, the ensuing process is not isomorphic to a mathematical function.&nbsp; The process interacts with the non-mathematical world, which a mathematical function can never do.&nbsp; So it has a side effect along with its ordinary representational effect.<br>
<br>The point being that the metalanguage commonly used to describe IO in Haskell contains a logical contradiction.&nbsp; A thing cannot be both a value and a function, but e,g, getChar behaves like a function and has the type signature of a value.&nbsp; I believe this is part of the reason the IO monad is troublesome for beginners (I speak from experience).<br>
<br>-g<br></div></div><br>