<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi all,<div><br></div><div>I’m trying to do this:</div><div><div><br></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div><font face="Menlo">data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">instance Functor Tree where</font></div><div><font face="Menlo">  fmap g Empty          = Empty</font></div><div><font face="Menlo">  fmap g (Leaf x)       = Leaf (g x)</font></div><div><font face="Menlo">  fmap g (Node t1 x t2) = Node (fmap g t1) (g x) (fmap g t2)</font></div><div><br></div><div><font face="Menlo">instance Foldable Tree where</font></div><div><font face="Menlo">   foldMap f Empty = mempty</font></div><div><font face="Menlo">   foldMap f (Leaf x) = f x</font></div><div><font face="Menlo">   foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r</font></div><div><br></div><div><font face="Menlo">instance (Monoid (f (Tree a))) => Traversable (Tree (f a)) where</font></div><div><font face="Menlo">  sequenceA Empty          = pure Empty</font></div><div><font face="Menlo">  sequenceA (Leaf f)       = Leaf <$> f</font></div><div><font face="Menlo">  sequenceA (Node t1 f t2) = (sequenceA t1) `mappend` (Leaf <$> f) `mappend` (sequenceA t2)</font></div></blockquote><div><div><br></div><div>And I’m being told this:</div><div><br></div></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div><span style="color: rgb(255, 0, 0); font-family: monospace; font-size: 14px; font-style: italic; white-space: pre; background-color: rgb(255, 255, 255);">The first argument of ‘Traversable’ should have kind ‘* -> *’, but ‘Tree (f a)’ has kind ‘*’</span></div><div><span style="color: rgb(255, 0, 0); font-family: monospace; font-size: 14px; font-style: italic; white-space: pre; background-color: rgb(255, 255, 255);">In the instance declaration for ‘Traversable (Tree (f a))’</span></div></blockquote><div><div style="font-family: ArialMT;"><span style="color: rgb(255, 0, 0); font-family: monospace; font-size: 14px; font-style: italic; white-space: pre; background-color: rgb(255, 255, 255);"><br></span></div><div style="font-family: ArialMT;">And I don’t quite understand what I’m asking for that’s forbidden.</div><div style="font-family: ArialMT;">Is it that I’m trying to declare that only a certain subset of <i>Trees</i> are Traversable, and that’s not okay? It’s got to be all Trees or no Trees are Traversable?</div></div></div><div><br></div><div>Thanks,</div><div>-db</div><div><br></div></body></html>