title: Generalized foldr function for trees?
body: <p>How can I write a generalized foldr function for generic Haskell trees?</p>
  
  <pre><code>data (Eq a, Show a) =&gt; Tree a = Void | Node a [Tree a]
      deriving (Eq, Show)
  
  treefold :: (Eq a, Show a) =&gt; (a -&gt; [b] -&gt; b) -&gt;  b -&gt; Tree a -&gt; b
  </code></pre>
  
  <p>I'm stuck at the first argument definition...</p>
  
  <p><strong>EDIT</strong>: what about a more generalized version, avoiding using lists? <a href="https://stackoverflow.com/questions/4986823/generalized-foldr-and-foldl-for-using-with-generic-haskell-trees">More here</a></p>