我正在查看Haskell O'Reilly书中的问题.我正在处理的问题是
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.
Run Code Online (Sandbox Code Playgroud)
我正在将我的代码写在一个名为ch3.hs的文件中.这是我的代码:
36 data Tree a = Node a (Tree a) (Tree a)
37 …Run Code Online (Sandbox Code Playgroud) 在test.hs中,我有:
doubleMe x = x + x
Run Code Online (Sandbox Code Playgroud)
在ghci中,我键入:
Prelude> :l test
[1 of 1] Compiling Main ( test.hs, interpreted )
Ok, modules loaded: Main.
*Main> doubleMe 9
<interactive>:1:0: Not in scope: `doubleMe'
*Main>
Run Code Online (Sandbox Code Playgroud)
为什么?怎么修?