title: No instance for (Num int) arising from the literal `0'
body: <p>I have a simple function and get a compiled error like the following:</p>
  
  <pre><code>fac::[int] -&gt; int
  fac [] = 0
  fac (x:[]) = x
  fac ([xs]) =  sum [xs]
  </code></pre>
  
  <p>Compile error:</p>
  
  <pre><code>  No instance for (Num int) arising from the literal `0'
      Possible fix:
        add (Num int) to the context of
          the type signature for fac :: [int] -&gt; int
      In the expression: 0
      In an equation for `fac': fac [] = 0
  </code></pre>
  
  <p>What is wrong with the codes?</p>