data (Ord a) => Stree a = Null
| Fork (Stree a) a (Stree a)
mkStree :: (Ord a) => [a] -> Stree a
mkStree [] = Null
mkStree (x:xs) = Fork (mkStree smaller) x (mkStree larger)
where (smaller,larger) = partition (<= x) xs
partition :: (a->Bool) -> [a] -> ([a],[a])
partition p xs = ([ x | x <- xs, p x],
[ y | y <- xs, (not . p) y])
如何解決這種故障 - >曖昧類出現「奧德」 *可以參考:Hugs.Prelude.Ord錯誤:不明確的類出現「奧德」
哪條線給你這個錯誤?數據行? 'mkStree'行?都? – dave4420 2010-11-08 15:25:02
此代碼似乎沒有任何類型錯誤。 – 2011-05-02 21:27:25