What would the Foldable instance for this datatype look like?
data X t = X t [X t]
I tried this:
instance Foldable X where
foldMap f (X x xs) = f x `mappend` foldMap f xs
But got this error:
Occurs check: cannot construct the infinite type: a = X a
When generalising the type(s) for `foldMap'
In the instance declaration for `Foldable X'