title: mapping over binary tree
body: <p>This is my function that map over a binary tree</p>
  
  <pre><code>type 'a btree = Empty
              |Node of 'a * 'a btree * 'a btree
  
  let rec treemap t f = match t with
    |Empty -&gt; Empty
    |Node(root,left,right)-&gt; Node(root f, treemap left f, treemap right f)                
  </code></pre>
  
  <p>The type of the function has to be:</p>
  
  <pre><code>treemap: 'a btree -&gt; ('a -&gt;'b) -&gt; 'b tree
  </code></pre>
  
  <p>but my function is returning this type instead: </p>
  
  <pre><code>val treemap : ('a -&gt; 'b) btree -&gt; 'a -&gt; 'b btree
  </code></pre>