title: Prime Number generator with recursion and list comprehension
body: <p>I am a newbie to Haskell programming and have trouble understanding how the below list comprehension expands. </p>
  
  <pre><code>primes = sieve [2..] 
  sieve (p:xs) = p : sieve [x | x &lt;-xs, x `mod` p /= 0]
  </code></pre>
  
  <p>Can someone correct me how the <code>sieve</code> expansion works:</p>
  
  <ul>
  <li>As we are pattern matching in <code>sieve</code>, <code>p</code> would associate to <code>2</code> and <code>x</code>s from <code>[3..]</code>.</li>
  <li>Next, in the list comprehension <code>x&lt;-3</code>, but then how can we call sieve with just <code>3</code> when there is no short-circuit.</li>
  </ul>
  
  <p>Other thing I do not understand is how recursion works here.</p>
  
  <p>I think it would be clear if one could expand the above one step at a time for first few numbers, say until <code>5</code>.</p>