title: Generate First n Primes (Haskell)
body: <p>I have this function:</p>
  
  <pre><code>generatePrimes :: Integral a =&gt; a -&gt; [a]
  generatePrimes n = [i | i &lt;- [2..], isPrime i]
  </code></pre>
  
  <p>I am trying to get the first <em>n</em> primes. I know that I can call the function in <code>main</code> by using the <code>take</code> function (and get the first <em>n</em> elements of the list), but I want to be able to have the function stop when it reaches <em>n</em> primes (inside the function), so that when it is called in <code>main</code> such as:</p>
  
  <pre><code>generatePrimes 8
  </code></pre>
  
  <p>it will display a list with only the first 8 primes.</p>