无法按高度比较具有大于 (>) 和大于或等于 (>=) 符号的树。这是我的代码。只是在 tree1 >= tree2 命令时挂起
data Tree a = Node a [Tree a] deriving (Eq,Show)
instance (Ord a) => Ord (Tree a) where
Node a list1 >= Node b list2 = (list1 > list2) || (list1 == list2)
(Node a list1) > (Node b list2) = (list1 > list2)
t0 = Node 15 []
t1 = Node 15 []
t2 = Node 120 [t0]
tree1 = Node 130 [t1,t2]
tt0 = Node 155 []
tt1 = Node 112 [t2]
tt2 = Node 128 [t0]
tree2 = Node 110 [tt1,tt2,tt0]