title: Haskell error when trying to get the last element
body: <p>So, I am trying to implement a function that, given a list of 3 elements <code>((Int,Int),Int)</code>, returns <code>True</code> when on the second position is the same value for all 3 and <code>False</code> otherwise.</p>
  
  <p>For instance, <code>[((1,2),7),((5,3),7),((1,9),7)]</code> should return <code>True</code> and <code>[((1,2),3),((5,3),3),((1,9),5)]</code> should return <code>False</code>.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>bc :: [((Int,Int),Int)]
  wcheck :: [((Int,Int),Int)] -&gt; Bool
  wcheck bc
     | (( fst(fst bc) == fst(snd bc) ) &amp;&amp; ( fst(snd bc) == fst(last bc) )) = True
     | otherwise                                                           = False
  </code></pre>
  
  <p>And the error that I get:</p>
  
  <pre><code>E:\\study related\Module1\week 4\ttt.hs:55:65: error:
  * Couldn't match expected type `[(a, b0)]'
                with actual type `((a, b), (a, b1))'
  * In the first argument of `last', namely `bc'
    In the first argument of `fst', namely `(last bc)'
    In the second argument of `(==)', namely `fst (last bc)'
  * Relevant bindings include
      bc :: ((a, b), (a, b1))
        (bound at E:\\study related\Module1\week 4\ttt.hs:54:8)
      wcheck :: ((a, b), (a, b1)) -&gt; Bool
        (bound at E:\\study related\Module1\week 4\ttt.hs:54:1)
     |
  55 |  | (( fst(fst bc) == fst(snd bc) ) &amp;&amp; ( fst(snd bc) == fst(last bc) )) = True
     |
  </code></pre>
  
  <p>Could you please tell me why I get this error and a way to fix it? Thank you.</p>