title: Setting upper limit to the input set according to the output function
body: <p>I'm currently stuck on setting upper limits in list comprehensions.</p>
  
  <p>What I'm trying to do is to find all Fibonacci numbers below one million.
  For this I had designed a rather simple recursive Fibonacci function</p>
  
  <pre><code>fib :: Int -&gt; Integer
  fib n
      n == 0    = 0
      n == 1    = 1
      otherwise = fib (n-1) + fib (n-2)
  </code></pre>
  
  <p>The thing where I'm stuck on is defining the one million part. What I've got now is:</p>
  
  <pre><code>[ fib x | x &lt;- [0..35], fib x &lt; 1000000 ]
  </code></pre>
  
  <p>This because I know that the 35th number in the Fibonacci sequence is a high enough number.
  However, what I'd like to have is to find that limit via a function and set it that way.</p>
  
  <pre><code>[ fib x | x &lt;- [0..], fib x &lt; 1000000 ]
  </code></pre>
  
  <p>This does give me the numbers, but it simply doesn't stop. It results in Haskell trying to find Fibonacci numbers below one million further in the sequence, which is rather fruitless.</p>
  
  <p>Could anyone help me out with this? It'd be much appreciated!</p>