title: Couldn't match expected type `[Char]' with actual type `a'
body: <p><strong><em>I've never seen this concrete question before in Stackoverflow and other questions didn't help me (I've tried before open this ask).</em></strong></p>
  
  <p>When I try to print a Binary Tree following this way:</p>
  
  <pre><code>data BinTree a = ET | Branch (BinTree a) a (BinTree a) deriving Show
  
  ejC:: BinTree a -&gt; String
  ejC ET = ""
  ejC (Branch x y z) = (ejC x) ++ "|-" ++ y ++ "-|" ++ (ejC z)
  </code></pre>
  
  <p>The module gives this error:</p>
  
  <pre><code>Couldn't match expected type `[Char]' with actual type `a'
  `a' is a rigid type variable bound by
  the type signature for ejC :: BinTree a -&gt; String at Types2.hs:24:7
  Relevant bindings include
  z :: BinTree a (bound at Types2.hs:26:17)
  y :: a (bound at Types2.hs:26:15)
  x :: BinTree a (bound at Types2.hs:26:13)
  ejC :: BinTree a -&gt; String (bound at Types2.hs:25:1)
  In the first argument of `(++)', namely `y'
  In the second argument of `(++)', namely `y ++ "-|" ++ (ejC z)'
  </code></pre>
  
  <p>Thank you all.</p>