<div dir="ltr">Good point. However, I forced the result to evaluate using `deepseq` and I still got similar results.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 24, 2013 at 11:41 AM, Gershom Bazerman <span dir="ltr">&lt;<a href="mailto:gershomb@gmail.com" target="_blank">gershomb@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    <div>On 1/24/13 9:31 AM, Daniel Díaz
      Casanueva wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          <div><span style="font-family:courier new,monospace">import
              Control.Monad<br>
            </span></div>
          <span style="font-family:courier new,monospace">import
            qualified Data.Sequence as Seq<br>
            <br>
          </span></div>
        <div><span style="font-family:courier new,monospace">type Seq =
            Seq.Seq<br>
          </span></div>
        <div><span style="font-family:courier new,monospace"><br>
          </span></div>
        <div><span style="font-family:courier new,monospace">f :: Monad
            m =&gt; Int -&gt; m a -&gt; m (Seq a)<br>
            f n = fmap Seq.fromList . replicateM n<br>
            <br>
          </span></div>
        <div><span style="font-family:courier new,monospace">g :: Monad
            m =&gt; Int -&gt; m a -&gt; m (Seq a)<br>
          </span></div>
        <div><span style="font-family:courier new,monospace">g =
            Seq.replicateM</span><br>
        </div>
        <div>
          <div>
            <div>
              <div><br>
              </div>
              Maybe is just in my test case, where the Int argument is
              big and the monadic action short, but it looks to me that
              Data.Sequence.replicateM can be faster than it is right
              now.<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></div>
    Are you forcing the full sequence in both cases? In the former case,
    you&#39;ll get all the actions, but have a thunk containing the result
    of Seq.fromList. In the latter, you&#39;re performing the actions as you
    build the sequence, so the resultant sequence will be fully
    evaluated.<br>
    <br>
    I imagine that this is the reason that the former seems faster to
    you.<span class="HOEnZb"><font color="#888888"><br>
    <br>
    --g<br>
  </font></span></div>

<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>E-mail sent by Daniel Díaz Casanueva<br></div><div><div><br>let f x = x in x<br></div></div></div>
</div>