У меня есть следующее определение дереваСкладная и деревья
data Tree a = Leaf a
| Node [Tree a]
deriving (Show)
И следующий экземпляр складная:
instance Foldable (Tree) where
foldMap f (Leaf t) = (f t)
foldMap f (Node t) = (foldMap `mappend` (foldMap f) t)
Этот код бросает меня и ошибка
Couldn't match type `a' with `Tree a'
`a' is a rigid type variable bound by
the type signature for
foldMap :: Monoid m => (a -> m) -> Tree a -> m
at trees.hs:8:5
Expected type: [a]
Actual type: [Tree a]
Как сделать Я делаю t в объявлении экземпляра типа Tree a вместо?