1
À quoi l'instance Foldable de ce type de données ressemblerait-elle?Définition d'une instance pliable apparemment simple
data X t = X t [X t]
J'ai essayé ceci:
instance Foldable X where
foldMap f (X x xs) = f x `mappend` foldMap f xs
mais nous avons eu cette erreur:
Occurs check: cannot construct the infinite type: a = X a
When generalising the type(s) for `foldMap'
In the instance declaration for `Foldable X'