1
이 데이터 유형의 Foldable 인스턴스는 어떻게 생겼을까요?간단하게 보이는 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'