title: Is operational really isomorphic to a free monad?
body: <h3>Proofs</h3>
  
  <p>In <a href="http://www.haskellforall.com/2012/07/purify-code-using-free-monads.html">this</a> blog post, Tekmo makes the point that we can prove that <code>ExitSuccess</code> exits because (I presume) it's like the <code>Const</code> functor for that constructor (it doesn't carry the <code>x</code> so <code>fmap</code> behaves like <code>const</code>).</p>
  
  <p>With the operational package, Tekmo's <code>TeletypeF</code> might be translated something like this:</p>
  
  <pre><code>data TeletypeI a where
      PutStrLn :: String -&gt; TeletypeI ()
      GetLine :: TeletypeI String
      ExitSuccess :: TeletypeI ()
  </code></pre>
  
  <p>I've read that operational is isomorphic to a free monad, but can we prove here that <code>ExitSuccess</code> exits?  It seems to me that it suffers from exactly the same problem as <code>exitSuccess :: IO ()</code> does, and in particular if we were to write an interpreter for it, we'd need to write it like as if it didn't exit:</p>
  
  <pre><code>eval (ExitSuccess :&gt;&gt;= _) = exitSuccess
  </code></pre>
  
  <p>Compare to the free monad version which doesn't involve any pattern wildcard:</p>
  
  <pre><code>run (Free ExitSuccess) = exitSuccess
  </code></pre>
  
  <h3>Laziness</h3>
  
  <p>In the <a href="http://apfelmus.nfshost.com/articles/operational-monad.html">Operational Monad Tutorial</a> apfelmus mentions a drawback:</p>
  
  <blockquote>
    <p>The state monad represented as s -> (a,s) can cope with some infinite
    programs like</p>
  
  <pre><code>evalState (sequence . repeat . state $ \s -&gt; (s,s+1)) 0
  </code></pre>
    
    <p>whereas the list of instructions approach has no hope of ever handling
    that, since only the very last Return instruction can return values.</p>
  </blockquote>
  
  <p>Is this true for free monads as well?</p>