나는 누적기를 사용하여 목록의 삼항 트리를 연결하는 함수를 만들고 있습니다.세번째 트리에서리스트 연결하기
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'