【发布时间】:2011-09-20 23:47:32
【问题描述】:
代码如下:
data Tree t = NilT
| Node t (Tree t) (Tree t)
instance Show (Tree t) where
show NilT = ""
show Node t l r = (show t) ++ ", " ++ (show l) ++ ", " ++ (show r)
如何在默认设置的“t show”中使用“show”,在自己定义的树形数据中使用“show”?
【问题讨论】:
-
这是一道作业题吗?它看起来与最近的问题 stackoverflow.com/questions/7478878/… 和 stackoverflow.com/questions/7479252/… 非常相似
标签: haskell instance ambiguous