title: Using binary search tree with custom data types?
body: <p>I've create a binary search tree:</p>
  
  <pre><code>data SearchTree a = Empty | Node a (SearchTree a) (SearchTree a) deriving (Show, Eq, Ord)
  
  insertTreeElements :: (Ord a) =&gt; a -&gt; SearchTree a -&gt; SearchTree a --Create    binary tree input method
  insertTreeElements x Empty = Node x Empty Empty
  insertTreeElements x (Node a left right)
     | x == a     = Node x left right
     | x &lt; a  = Node a (insertTreeElements x left) right
     | x &gt; a      = Node a left (insertTreeElements x right)
  
  makeTree :: (Ord a) =&gt; (a -&gt; SearchTree a -&gt; SearchTree a) -&gt; SearchTree a -&gt; [a] -&gt; SearchTree a --Create binary tree
  makeTree iTE Empty li = foldr iTE Empty li
  </code></pre>
  
  <p>I'm trying to pass in the following list:</p>
  
  <pre><code>Type Age = Int
  mylist = [Age 12, Age 100, Age 2, Age 3, Age 43]
  </code></pre>
  
  <p>However the output is not correct, it does not order the tree based on the size of the ages? How do I need to edit the insertTreeElements to allow it to work with 'Age x'? </p>