次のデータ型
data Tree a = Node a [Tree a]
私は次の関数を作成したいと思います:
labels:: Tree a -> [a]
labels (Node label children) = label: (map labels children)
しかし、このfalsは
* Occurs check: cannot construct the infinite type: a ~ [a]
Expected type: [a]
Actual type: [[a]]
x:xsとして子供を持つことは、xsはまだツリーのリストであり、単一のツリーではありません。