1
我正在使用累加器構造一個連接列表三元樹的函數。在三元樹中連接列表
19 data Ttree t = Nil | Node3 t (Ttree t) (Ttree t) (Ttree t)
20
21 acc :: Ttree [a] -> [a]
22 acc tree = acc' tree []
23
24 acc' :: Ttree [a] -> [a] -> [a]
25 acc' Nil rest = rest
26 acc' (Node3 xs l m r) rest =
27 xs $ acc' l $ acc' m $ acc' r rest
我得到這個錯誤,使用ghc。但我不看到預期類型xs如何是一個 - > B:
e6.hs:26:4:
Couldn't match expected type `a -> b' against inferred type `[a1]'
In the first argument of `($)', namely `xs'