title: Haskell: Non-exhaustive patterns in function (simple functions)
body: <p>I am confused as to why the 1st and 3rd versions of this functions give this error whereas the second definition works fine.</p>
  
  <pre><code>-- head and tail
  third :: [a] -&gt; a
  third [a] = head (tail (tail[a]))
  
  -- Pattern matching
  third2 :: [a] -&gt; a
  third2 (_:_:x:_) = x
  
  -- List indexing
  third3 :: [a] -&gt; a
  third3 [a] = [a]!!2
  </code></pre>
  
  <p>Thanks in advance</p>