Как будет выглядеть экземпляр Foldable для этого типа данных?
data X t = X t [X t]
Я пробовал это:
instance Foldable X where
foldMap f (X x xs) = f x `mappend` foldMap f xs
Но получил эту ошибку:
Occurs check: cannot construct the infinite type: a = X a
When generalising the type(s) for `foldMap'
In the instance declaration for `Foldable X'