I went with the default being to avoid prematurely forcing a bottom when possible, to avoid being called out by the strictness police, but I&#39;m not terribly wedded to the behavior.<div><br></div><div>-Edward<br><br><div class="gmail_quote">
On Fri, Jan 21, 2011 at 7:27 PM, Isaac Dupree <span dir="ltr">&lt;<a href="mailto:ml@isaac.cedarswampstudios.org">ml@isaac.cedarswampstudios.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On 01/21/11 18:33, Edward Kmett wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;d like to propose adding the following missing instances to Data.Foldable<br>
and Data.Traversable respectively, since there isn&#39;t a canonical location<br>
that they could be added outside of those packages without orphans, their<br>
definition is unambiguous, and they are quite useful (plus, I happen to need<br>
them for a monad transformer in my adjunctions package).<br>
<br>
instance Foldable (Either a) where<br>
   foldMap f (Left a) = mempty<br>
   foldMap f (Right b) = f b<br>
<br>
instance Foldable ((,)e) where<br>
   foldMap f ea = f (snd ea)<br>
<br>
instance Traversable (Either a) where<br>
   traverse f (Left a) = pure (Left a)<br>
   traverse f (Right a) = Right&lt;$&gt;  f a<br>
<br>
instance Traversable ((,)e) where<br>
   traverse f ~(e,a) = (,) e&lt;$&gt;  f a<br>
</blockquote>
<br></div></div>
Those look correct.  Is there some reason you chose to make the (,) instances less strict in the pair?  For example, traverse on &quot;undefined&quot; gives you, modulo the applicative layer, &quot;(undefined, f undefined)&quot;.  (I haven&#39;t thought of a reason (practical or theoretical) for either behavior.)<br>

<br>
-Isaac<br>
<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</blockquote></div><br></div>