title: Does Haskell have tail-recursive optimization?
body: <p>I discovered the "time" command in unix today and thought I'd use it to check the difference in runtimes between tail-recursive and normal recursive functions in Haskell.</p>
  
  <p>I wrote the following functions:</p>
  
  <pre><code>--tail recursive
  fac :: (Integral a) =&gt; a -&gt; a
  fac x = fac' x 1 where
      fac' 1 y = y
      fac' x y = fac' (x-1) (x*y) 
  
  --normal recursive
  facSlow :: (Integral a) =&gt; a -&gt; a
  facSlow 1 = 1
  facSlow x = x * facSlow (x-1)
  </code></pre>
  
  <p>These are valid keeping in mind they were solely for use with this project, so I didn't bother to check for zeroes or negative numbers.</p>
  
  <p>However, upon writing a main method for each, compiling them, and running them with the "time" command, both had similar runtimes with the <em>normal</em> recursive function edging out the tail recursive one. This is contrary to what I'd heard with regards to tail-recursive optimization in lisp. What's the reason for this?</p>