title: Combine two tuples with a nested list comprehension
body: <p>I have an interesting problem to figure out involving nested list comprehensions. I will redact unnecessary details for this post, as such the problem I'm trying to solve may seem a little peculiar. </p>
  
  <p>I have two tuples as follows <code>("X", "Y", "Z")</code> and <code>("1", "2")</code>. The contents of these will only ever be as written above.</p>
  
  <p>Using these two lists, I need to construct a list of 3-tuples, <strong>with every combination of the contents of the above two lists</strong>. An example of one of these tuples would be <code>("X2", "Z2", "Y1)</code>. Note the numbers always come after the letters.</p>
  
  <p>I know I need to use a list comprehension for this, but it seems like I need to have a nested list comprehension somehow, which I am not familiar with.</p>
  
  <p>I started with this:</p>
  
  <p><code>[(comb1, comb2, comb2) | {- What goes here? -}]</code></p>
  
  <p>I am not sure how to proceed. How can I solve this problem with a nested list comprehension? I believe a nested list comprehension is the best way to solve this problem but if you know of a better way please explain that instead.</p>
  
  <p><strong>EDIT with some further details:</strong></p>
  
  <p>This list of tuples will be output by a function that would look something like this:</p>
  
  <pre><code>init :: [(String, String, String)]
  init = [(comb1, comb2, comb3) | {- What goes here? -}]
  </code></pre>
  
  <p>The return value from the init function will be used in the context of a larger program that will need to perform tasks on this list of 3-tuples. The actual two tuples, <code>("X", "Y", "Z")</code> and <code>("1", "2")</code>, will be hardcoded into the list comprehension of the <code>init</code> function. </p>
  
  <p>There are more combinations than just what a cartesian product gives. The cartesian product would result in <code>[["X1","Y1","Z1"],["X2","Y2","Z2"]]</code>. However, the letters need not be in order, and some letters might not appear in one of the results at all. <code>["Z1", "X2", "X1"]</code> is also a valid combination</p>