1
我是哈斯克尔的新手,我想用类show来实例树a。树数据结构的实例显示
data Tree a = Null
|Node (Tree a) a (Tree a)
instance Show (Tree a) where
show Null = ""
show Node ((Tree l) (v) (Tree r)) = "|"--I don´t know how i can do this step
感谢您的帮助。
大括号是在错误的地方。尝试show(Node(Tree l)(v)(Tree r))= ...' –
它给出一个错误ERROR file:。\ Tree.hs:6 - 未定义的数据构造函数“Tree” – tomss
@tomss I comment on在Abhinav的回答下,简单地删除'树'。 –