title: Haskell cartesian product of infinite lists
body: <p>I want to generate a vectorspace from a basis pair, which looks something like:</p>
  
  <pre><code>genFromPair (e1, e2) = [x*e1 + y*e2 | x &lt;- [0..], y &lt;- [0..]]
  </code></pre>
  
  <p>When I examine the output though, it sems like I'm getting <code>[0, e2, 2*e2,...]</code> (i.e. <code>x</code> never gets above 0). Which sort of makes sense when I think about how I would write the code to do this list comprehension.</p>
  
  <p>I wrote some code to take expanding "shells" from the origin (first the ints with norm 0, then with norm 1, then norm 2...) but this is kind of annoying and specific to Z^2 - I'd have to rewrite it for Z^3 or Z[i] etc. Is there a cleaner way of doing this?</p>