title: Why I'm getting "Exception: Prelude.head: empty list"?
body: <p>Can't figure out why the pattern matching isn't working! I'm beginning with Hasklell, so be patient!</p>
  
  <pre><code>-- matrix implemented as a list of lists (rows of the matrix)
  test_matrix3 = [[1,0,0],[2,-3,0],[4,5,6]]
  
  -- transpose of a given matrix
  transpose    (x:[]) = [x]
  transpose all@(x:_) = map head all : transpose ([tail y | y &lt;- all])
  </code></pre>
  
  <p>Executing:</p>
  
  <pre><code>*Main&gt; transpose test_matrix3
  [[1,2,4],[0,-3,5],[0,0,6],[*** Exception: Prelude.head: empty list
  </code></pre>