Think of &quot;traverse&quot; as a &quot;mapA&quot;, as it&#39;s just like Data.Traversable.mapM, but with the Applicative class constraint instead of the Monad one. <br>I&#39;ve always wondered why it isn&#39;t called this way, sequenceM equivalent for Applicatives is sequenceA for instance.<br>

<br><div class="gmail_quote">Le 28 mars 2012 22:19, Christopher Done <span dir="ltr">&lt;<a href="mailto:chrisdone@googlemail.com">chrisdone@googlemail.com</a>&gt;</span> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On 28 March 2012 22:05, Matthew Steele &lt;<a href="mailto:mdsteele@alum.mit.edu">mdsteele@alum.mit.edu</a>&gt; wrote:<br>
&gt; Doesn&#39;t for already exist, in Data.Traversable?   Except that for =<br>
&gt; flip traverse.<br>
<br>
</div>Traverse doesn&#39;t fit the type of fmap, it demands an extra type constructor:<br>
<br>
traverse :: (Traversable t,Applicative f) =&gt; (a -&gt; f b) -&gt; t a -&gt; f (t b)<br>
<br>
fmap :: Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b<br>
<br>
Note the (a -&gt; f b) instead of (a -&gt; b).<br>
<br>
E.g.<br>
<br>
fmap :: (a -&gt; b) -&gt; [a] -&gt; [b]<br>
<br>
can&#39;t be expressed with traverse, you can only get this far:<br>
<br>
traverse :: (a -&gt; [b]) -&gt; [a] -&gt; [[b]]<br>
<br>
Unless I&#39;m missing something.<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>