title: Haskell - Sum up the first n elements of a list
body: <p>I´m new to Haskell.</p>
  
  <p>Let´s say I want to sum up the first <em>n</em> elements of a list with a generated function on my own. I don´t know how to do this with Haskell. I just know how to sum up a whole given list, e.g.</p>
  
  <pre><code>sumList :: [Int] -&gt; Int
  sumList [] = 0
  sumList (x:xs) = x + sumList xs
  </code></pre>
  
  <p>In order to sum up the first <em>n</em> elements of a list, for example</p>
  
  <blockquote>
    <p>take the first <em>5</em> numbers from <code>[1..10]</code>, which is <em>1+2+3+4+5 = 15</em></p>
  </blockquote>
  
  <p>I thought I could do something like this:</p>
  
  <pre><code>sumList :: Int -&gt; [Int] -&gt; Int
  sumList take [] = 0
  sumList take (x:xs) = x + take $ sumList xs
  </code></pre>
  
  <p>But it doesn´t work... What´s wrong?</p>