title: Function recursing when it shouldn't
body: <p>I have the following function:</p>
  
  <pre><code>followConnections :: [Connection]-&gt;Crib-&gt;Stecker-&gt;Offsets-&gt;Maybe Stecker
  followConnections [] _ y _ = Just (y)
  followConnections w x y z
      | fC /= Nothing = trace("Follow Connections recursing") followConnections (tail w) x (fromMaybe(fC)) z
      | fC == Nothing = trace("Follow connections fail! for " ++ show y) Nothing
      where
      fC = followConnection (head w) x y z
  </code></pre>
  
  <p>Technically, the function should recurse if the current element of <code>[Connection]</code> does not cause <code>followConnection</code> to return <code>Nothing</code>, or return <code>Nothing</code> otherwise.
  However, by tracing the function I saw that it will recurse until <code>[Connection]</code> is empty even at some point it fails.</p>
  
  <p>Any idea of why this may be??</p>
  
  <p>Thanks!</p>