title: Non-exhaustive patterns in function (Haskell)
body: <p>I have two code snippets that throw the same error:</p>
  
  <pre><code>Prelude&gt; sum' [] = 0
  Prelude&gt; sum' (x:xs) = x + sum' xs
  Prelude&gt; sum' [1,2,3,4,5]
  *** Exception: &lt;interactive&gt;:142:1-25: Non-exhaustive patterns in function sum'
  </code></pre>
  
  <p>and the following as well:</p>
  
  <pre><code>Prelude&gt; prod [] = 1
  Prelude&gt; prod (x:xs) = x * (prod xs)
  Prelude&gt; prod [1,2,3,4,5]
  *** Exception: &lt;interactive&gt;:139:1-27: Non-exhaustive patterns in function prod
  </code></pre>
  
  <p>I must be missing a pattern, but what is it? Also, how do I such errors? How should I think when defining a function using pattern matching? (I'm asking for a methodolgy/technique)</p>