title: haskell list comprehension optimization
body: <p>I have a piece of code written for project euler: </p>
  
  <pre><code>primes :: [Integer]
  primes = filter isPrime [2..]
      where isPrime n = not $ any (\x -&gt; n `mod` x == 0) [2..n-1]
  
  ans = max [x | x &lt;- primes, 600851475143 `mod` x == 0]
  </code></pre>
  
  <p>Of course I didn't wait for it to terminate. But I'm wondering will it ever return? I guess it depends on whether haskell knows to stop at 600851475143?</p>