title: foldl is tail recursive, so how come foldr runs faster than foldl?
body: <p>I wanted to test foldl vs foldr. From what I've seen you should use foldl over foldr when ever you can due to tail reccursion optimization.</p>
  
  <p>This makes sense. However, after running this test I am confused:</p>
  
  <p>foldr (takes 0.057s when using time command):</p>
  
  <pre><code>a::a -&gt; [a] -&gt; [a]
  a x = ([x] ++ )
  
  main = putStrLn(show ( sum (foldr a [] [0.. 100000])))
  </code></pre>
  
  <p>foldl (takes 0.089s when using time command):</p>
  
  <pre><code>b::[b] -&gt; b -&gt; [b]
  b xs = ( ++ xs). (\y-&gt;[y])
  
  main = putStrLn(show ( sum (foldl b [] [0.. 100000])))
  </code></pre>
  
  <p>It's clear that this example is trivial, but I am confused as to why foldr is beating foldl. Shouldn't this be a clear case where foldl wins?</p>