title: haskell, Functor for Data Binary Tree
body: <p>I am trying to write functor for Tree (form of this type is given below)</p>
  
  <pre><code>data Tree a = Empty | Node a (Tree a) (Tree a) 
  
  instance Functor Tree where
      fmap f Empty = Empty
      fmap f (Node a x y) =  Node (f a) (fmap f x) (fmap f y)
  </code></pre>
  
  <p>It seems to be working, but what about more elegant (I am newbie in haskell) solutions? 
  The second issue is that lecturer wrote signature:  <code>fmap :: (a -&gt; b) -&gt; f a -&gt; f b</code>
  for me, it is <code>(a-&gt;b) -&gt; Tree a -&gt;  Tree b</code>, but it is not accepted by compiler ghci. Where is the point ?</p>