title: rigid type variable error in Haskell
body: <p>Why this gives <code>rigid type variable</code> error:</p>
  
  <pre><code>data MyTree a  = Leaf [a]
                 | Branch (String, a) [MyTree a] 
                 deriving (Show)
  
  
  list :: MyTree a -&gt; [a]
  list (Leaf [])                = []
  list (Leaf m)                 = m
  list (Branch _ (x:xs))        = list x ++ map (list) xs
  
  -------------------------------------------------------------
  Couldn't match type `a' with `[a]'
        `a' is a rigid type variable bound by
            the type signature for list :: MyTree a -&gt; [a]
            at test.hs:6:15
      Expected type: MyTree a -&gt; a
        Actual type: MyTree a -&gt; [a]
      In the first argument of `map', namely `(list)'
      In the second argument of `(++)', namely `map (list) xs'
      In the expression: list x ++ map (list) xs
  </code></pre>