2
我在一个叫Tree2.hs进口哈斯克尔模块写着“不在范围内”
module Tree2
(
Tree
) where
data Tree a = EmptyTree | Node a (Tree a) (Tree a) deriving (Show)
文件创建的树结构,那么我进口它,并试图使用它作为一个类的实例
import qualified Tree2
class YesNo a where
yesno :: a -> Bool
instance YesNo (Tree2.Tree a) where
yesno EmptyTree = False
yesno _ = True
Not in scope: data constructor ‘EmptyTree’
Failed, modules loaded: Tree2.
谁知道为什么:
但在ghci中加载它,当我得到这个错误?