<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <blockquote cite="mid:4F63FA80.7070804@unicaen.fr" type="cite">It is
      the third or the fourth time that somebody recently puts the
      equivalence between the communication with the outer world, and
      "side effects". I contest that very strongly, perhaps a TRUE guru
      might instruct me.
      <br>
    </blockquote>
    <br>
    I think there are three key concepts rumbling around in this
    discussion that are related, but distinct: determinism, purity, and
    side effects.<br>
    <br>
    An easy trap to fall into is the idea that determinism = purity,
    when really they are not the same. There is a set of functions that
    are deterministic, but not pure. An example is putMVar:<br>
    <br>
    <a class="a"
href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Concurrent-MVar.html#v:putMVar"><b>putMVar</b></a><a
      class="dull"
href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Concurrent-MVar.html#v:putMVar">
      :: MVar a -&gt; a -&gt; IO ()</a><a name="v:putMVar" class="def"></a><br>
    <br>
    On the other hand, there are functions that are non-deterministic,
    but pure:<br>
    <br>
    nondeterministicAndPure :: () -&gt; MonadState Int Int<br>
    nondeterministicAndPure () = do<br>
    &nbsp; x &lt;- get<br>
    &nbsp; return x<br>
    <br>
    Then, there are functions that are both deterministic and pure, like
    lookup, and functions that are neither deterministic, nor pure, like
    takeMVar.<br>
    <br>
    I'm thinking that side effects are really only necessary because
    Haskell programs expect to mutate the state of a computer outside of
    the haskell program. Perhaps if we had Haskell OS, everything could
    live in some giant MonadState, and IO could be disposed of entirely.<br>
    <br>
    Jeff<br>
  </body>
</html>