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的回答下,簡單地刪除'樹'。 –