title: Haskell Recursive List Summation
body: <p>I'm new to functional programming and haskell, so I'm just starting out learning both by attempting some Euler problems. This involves a great deal of list summations.</p>
  
  <p>So I'm trying to write a recursive list summation function that takes one list as input and returns an integer as output, for instance:</p>
  
  <pre><code>-- Sum up a list
  listsum :: [int] -&gt; int
  listsum [a:b:[]] = a + b
  listsum x = head x + listsum tail x
  </code></pre>
  
  <p>When compiling this code, I receive this error: </p>
  
  <pre><code>Couldn't match expected type `[[int] -&gt; int]'
              with actual type `[a0] -&gt; [a0]'
  Relevant bindings include
    x :: [int]
      (bound at C:\Users\Rade\Documents\GitHub\haskell\euler_2.hs:15:9)
    listsum :: [int] -&gt; int
      (bound at C:\Users\Rade\Documents\GitHub\haskell\euler_2.hs:14:1)
  Probable cause: `tail' is applied to too few arguments
  In the first argument of `listsum', namely `tail'
  In the second argument of `(+)', namely `listsum tail x'
  </code></pre>
  
  <p>I've tried to research the pattern matching, but I cannot understand what it means with expected type versus actual type. Where am I going wrong?</p>