title: How to make a tail recursive function
body: <p>I am really confused on how to make a function "Tail recursive".</p>
  
  <p>Here is my function, but I don't know whether it is already tail recursive or not. </p>
  
  <p>I am trying to merge two lists in Haskell.</p>
  
  <pre><code>merge2 :: Ord a =&gt;[a]-&gt;[a]-&gt;[a]
  merge2 xs [] = xs
  merge2 [] ys = ys
  merge2 (x:xs)(y:ys) = if y &lt; x then y: merge2 (x:xs) ys else x :merge2 xs (y:ys)
  </code></pre>