title: Search through a BST in Standard ML
body: <p>The requirement is simple - given a root node and an <em>integer</em> to find, return whether or not the value is in the tree.</p>
  
  <p>Here is the data structure:</p>
  
  <pre><code> datatype either = ImAString of string | ImAnInt of int;
  </code></pre>
  
  <p>Here is the tree structure:</p>
  
  <pre><code> datatype eitherTree =
            Internal of {data: either, left: eitherTree, right: eitherTree}
          | Leaf of either
  </code></pre>
  
  <p>The function I have so far is:</p>
  
  <pre><code> fun eitherSearch (Leaf (ImAnInt i)) find = 
           if i = find then true else false
     | eitherSearch (Internal {left, right, (ImAnInt i)}) find = 
           ....
  </code></pre>
  
  <p>I have tested the first clause by itself, and the type extraction seems to work
  just fine there, but when I try to extract the <strong>(ImAnInt i)</strong> from the second clause I get an error. </p>
  
  <p>Any ideas?</p>