title: Haskell depth-first-search for a graph
body: <p>For hours now I am trying to implement a depth-first search for Haskell. My depthfirst algorithm has given a starting node and a graph. That is what I have so far + the definition of the graph datatype.</p>
  
  <pre><code>data Graph a = G [a] (BRfun a)
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>type BRfun a = a -&gt; [a]
  </code></pre>
  
  <p>current attempt:</p>
  
  <pre><code>depthFirst :: Eq a =&gt; a -&gt; Graph a -&gt; [a]
  depthFirst a (G [a] sucs) = [a]
  </code></pre>
  
  <p>So if only one element is in the nodes list that's the only one I have to put in the final list (I think that should be the cancellation condition).
  But now I am struggling to create an recursive algorithm to first get the deepest nodes.</p>