Good point. This brings us back to Russell&#39;s original suggestion of swap and swap&#39; to cover both cases. That module has all of ~4 methods in it right now. -- I&#39;m evaluating that lazily -- so its not exactly like adding both will break the complexity budget of a self-contained module designed to deal with tuples. ;)<br>
<br><div>-Edward Kmett</div><div><br><div class="gmail_quote">On Thu, Jun 18, 2009 at 1:27 AM, Jonathan Cast <span dir="ltr">&lt;<a href="mailto:jonathanccast@fastmail.fm">jonathanccast@fastmail.fm</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Thu, 2009-06-18 at 01:24 -0400, Edward Kmett wrote:<br>
&gt; If we look at swap from the standpoint of the laws/RULES it should<br>
&gt; support, viewing Hask over (,) as a symmetric monoidal category you<br>
&gt; get something like:<br>
&gt;<br>
&gt;<br>
&gt; {-# RULES<br>
&gt; &quot;swap . swap = id&quot; forall x. swap (swap x) = x<br>
&gt; &quot;fst . swap = snd&quot; forall x. fst (swap x) = snd x<br>
&gt; &quot;snd . swap = fst&quot; forall x. snd (swap x) = fst x<br>
&gt;  #-}<br>
&gt;<br>
&gt;<br>
&gt; That seems to argue for the lazy definition being the default to avoid<br>
&gt; the strict pattern match in swap breaking the latter very pleasing<br>
&gt; equalities.<br>
<br>
</div>Lazy swap fails the swap . swap rule:<br>
<br>
  swap (swap undefined)<br>
= swap (snd undefined, fst undefined)<br>
= swap (undefined, undefined)<br>
= (undefined, undefined)<br>
<br>
which is distinct from undefined because Haskell tuples are lifted.<br>
<br>
jcc<br>
<br>
<br>
</blockquote></div><br></div>