title: haskell depth tree
body: <p>I have got a tree and I need the depth of the tree, but it doesn't work.</p>
  
  <pre><code>data Tree a b = Leaf a | Branch (b,Tree a b) (b,Tree a b) deriving(Eq,Show)
  
  tree = Branch ("A",Branch("C",Leaf 3)("D",Branch("G",Leaf 7)("H",Leaf 6)))("B",Branch("E",Leaf 5)("F",Leaf 4))
  </code></pre>
  
  <p>My function:</p>
  
  <pre><code>depth (d,Leaf x) = 1
  depth (d,Branch a b) = 1 + (max (depth a) (depth b))
  </code></pre>
  
  <blockquote>
    <p>Couldn't match expected type `(t10, Tree t20 t10)'<br>
                    with actual type `Tree Integer [Char]'<br>
        In the first argument of `depth', namely `tree'<br>
        In the expression: depth tree<br>
        In an equation for `it': it = depth tree<br></p>
  </blockquote>