<p dir="ltr">It's not so much that it's *necessary* as that it's *possible*. The existence of two functions in Data.Traversable explains both of the superclasses of Traversable:</p>
<p dir="ltr">fmapDefault :: Traversable t => (a -> b) -> t a -> t b</p>
<p dir="ltr">foldMapDefault :: (Traversable t, Monoid m) => (a -> m) -> t a -> m</p>
<p dir="ltr">Each of these is written using only traverse, and they can be used to define fmap and foldMap for types when you've written traverse.</p>
<p dir="ltr">Hint: Consider traversing using the following applicative functors:</p>
<p dir="ltr">newtype Const a b = Const a<br>
instance Monoid a => Applicative (Const a)</p>
<p dir="ltr">newtype Identity a = Identity a<br>
instance Applicative Identity</p>
<div class="gmail_quote">On Feb 5, 2016 1:45 PM, "David Banas" <<a href="mailto:capn.freako@gmail.com">capn.freako@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I don't understand why Foldable is a necessary super-class of Traversable, and I suspect that the Applicative/Monoid duality, which I've just begun discovering in the literature, has something to do with why that is so.</div><div><br></div><div>Can anyone give me a hint, without giving me the answer?</div><div><br></div><div>Thanks!</div><div>-db</div><div><br></div></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div>