title: Beginning Haskell - getting "not in scope: data constructor" error
body: <p>I'm going through the problems in the Haskell O'Reilly book. The problem I am working on is </p>
  
  <pre><code>Using the binary tree type that we defined earlier in this chapter, 
  write a function that will determine the height of the tree. The height 
  is the largest number of hops from the root to an Empty. For example, the 
  tree Empty has height zero; Node "x" Empty Empty has height one; 
  Node "x" Empty (Node "y" Empty Empty) has height two; and so on.
  </code></pre>
  
  <p>I'm writing my code in a file called ch3.hs. Here's my code:</p>
  
  <pre><code>36 data Tree a = Node a (Tree a) (Tree a)
  37             | Empty
  38               deriving (Show)
  39
  40 --problem 9:Determine the height of a tree
  41 height :: Tree -&gt; Int
  42 height (Tree node left right) = if (left == Empty &amp;&amp; right == Empty) then 0 else max (height left) (height right) 
  </code></pre>
  
  <p>opening ghci in the terminal and typing :load ch3.hs. When I do that I get the following error:</p>
  
  <pre><code>Prelude&gt; :load ch3.hs
  [1 of 1] Compiling Main             ( ch3.hs, interpreted )
  
  ch3.hs:42:7: Not in scope: data constructor `Tree'
  Failed, modules loaded: none.
  </code></pre>
  
  <p>I expect that the Tree data constructor should be there, because I defined it in the lines above the height method. But when I try to load the file, I'm told that the data constructor is not in scope. I appreciate your help and explanation of why this error occurs. Thanks,
  Kevin</p>