title: How to properly implement a helper function in Haskell
body: <p><strong>The 'gridList' function description:</strong> </p>
  
  <p>Takes two <code>Integer</code> inputs, 
  <code>x</code> and <code>y</code>, and returns a list of tuples representing the coordinates
  of each cell from <code>(1,1)</code> to <code>(x,y)</code>. </p>
  
  <p><strong>Example Output</strong></p>
  
  <pre><code>$&gt; gridList 3 3
  $&gt; [(1,1),(2,1),(3,1),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)]
  </code></pre>
  
  <p><strong>Source Code</strong></p>
  
  <pre><code>gridList :: Integer -&gt; Integer -&gt; [(Integer,Integer)]
  gridList 1 1 = [(1,1)]
  gridList 1 y = helper 1 y
  gridList x y = (helper x y) ++ gridList (x-1) y
    where 
      helper :: Integer -&gt; Integer -&gt; [(Integer, Integer)]
      helper x 1 = [(x,1)]
      helper x y = (x,y) : (helper x (y-1))
  </code></pre>
  
  <p><strong>Question:</strong> The code doesn't compile giving the following <code>error: Variable not in scope</code>
  referring to the line 3 where the helper is first introduced. Why doesn't the <code>where</code>solve this problem? </p>
  
  <p>Thanks </p>