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中加載它,當我得到這個錯誤?