title: Haskell: f :: hex String -> Integer using tail recursion
body: <p>I'm looking for a way to change hex to an integer using tail recursion.  So far I've only tried terrible implementations of regular primitive recursion and I haven't even gotten close. Very frustrated.  Even examples of tail recursion will help and be greatly appreciated. I don't quite understand it well enough for this implementation.</p>
  
  <p>Example:</p>
  
  <ul>
  <li><code>"005" -&gt; 5</code></li>
  <li><code>"1E" -&gt; 30</code></li>
  </ul>
  
  <p>Restrictions: Cannot use imports or if, then, else etc, must be done with recursion if possible or tail recursion.</p>
  
  <p>My attempt at recursion.</p>
  
  <pre><code>    hexToInteger :: String -&gt; Integer
          |(x:xs) = []        = []
          |x == 0             = hexToInteger xs
          |otherwise          = addition x + hexToInteger xs
  
      addition :: String -&gt; Integer
      addition x 
          |--something to check what position we're dealing with and what hex value.
          |--Return the Integer value
  </code></pre>