title: How to return the second item of the nth pair in a given list (Haskell)
body: <p>I am wondering how to return the 2nd item of the nth pair in a given list. So we have </p>
  
  <pre><code>nth :: Int -&gt; [(Int,Int)] -&gt; Int
  </code></pre>
  
  <p>So if we input </p>
  
  <pre><code>nth 3 [(2,0),(1,4),(3,8)]
  </code></pre>
  
  <p>it should return 8 as this is the 2nd item of the 3rd pair.</p>
  
  <p>This is what I have got so far, it doesn't work...</p>
  
  <pre><code>nth :: Int -&gt; [(Int,Int)] -&gt; Int
  nth n [] = error "??"
  nth 0 (x:xs) = error "??"
  nth n (x:xs)
    |n &gt; 0 &amp;&amp; n &lt; length (x:xs) = -- dont know what to put here
  </code></pre>
  
  <p>Can anyone assist?</p>
  
  <p>Thanks
  Sam</p>