title: Haskell Targeting elements in list of lists
body: <p>Okay, I'm new to Haskell, and need help getting my head around functional approaches to     problems.</p>
  
  <p>I have a list of list. More specifically <code>[[Char]]</code>.</p>
  
  <p>I would like to target a specific element in a list, and look at the elements above, below, and to the left and right of the element.</p>
  
  <p>For example:</p>
  
  <pre><code>["-------",
   "-------",
   "---N---",
   "--WOE--",
   "---S---",
   "-------",
   "-------"]
  </code></pre>
  
  <p>Where <code>O</code> is the element I'm targeting, and <code>N,S,E,W</code> are the elements directly surrounding the element <code>O</code>.</p>
  
  <p>I'm made a function that gets an <code>(x,y)</code> coordinate of the element <code>O</code>, and it is as follows:</p>
  
  <pre><code>find :: Eq a =&gt; [[a]] -&gt; a -&gt; (Int,Int)
  find [[]] _ = (-1,-1)
  find (x:xs) el = findHelper (x:xs) (0,0,el)
  
  findHelper :: Eq a =&gt; [[a]] -&gt; (Int,Int,a) -&gt; (Int,Int)
  findHelper [[]] _ = (-1,-1)
  findHelper (x:xs) (row,col,el)
      | x == [] = findHelper xs (row+1,0,el)
      | (head x) == el = (row,col)
      | otherwise = findHelper ((tail x) : xs) (row,col + 1,el)
  </code></pre>
  
  <p>This <code>(x,y)</code> coordinate system is 0-indexed. I just can't for the life of me figure out once I have the position of the element I'm looking for, how to figure out what elements are surrounding it.</p>
  
  <p>Sorry if this isn't the most clear of questions, and I can elaborate more if I missed something.</p>