<div><div class="gmail_quote">On Thu, Apr 8, 2010 at 6:16 PM, wren ng thornton <span dir="ltr">&lt;<a href="mailto:wren@community.haskell.org">wren@community.haskell.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 class="im">wren ng thornton wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Edward Kmett wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&lt;**&gt; cannot be defined in terms of flip as it swaps the order of the effects as well.<br>
</blockquote>
<br>
But I thought:<br>
<br>
    (&lt;**&gt;) = liftA2 (flip ($))<br>
<br>
:)<br></blockquote></div></blockquote><div><br></div><div>=)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If (&lt;**&gt;) were to have been defined as flip(liftA2(flip($))), then I would be supportive of it. My definition has the same perspicuous type as (&lt;*&gt;) but adding support for non-LtR ordering of effects/evaluation, which seems to be the goal of the (&lt;**&gt;) combinator. However, (&lt;**&gt;) as it is actually defined forces one to give up the applicative style in order to alter evaluation ordering. In so doing it does not come to support another style and therefore simply looks like a wart on the API. Someone might could make an argument for (&lt;**&gt;) supporting a sort of object-oriented style in terms of evaluation order, but that style is not otherwise supported by the Applicative combinators, and so I wouldn&#39;t find it convincing.<div>
<div></div><div class="h5"><br></div></div></blockquote><div><br></div><div>As written</div><div><br></div><div>x &lt;**&gt; f =liftA2 (flip ($)) x f = flip id &lt;$&gt; x &lt;*&gt; f<div><br></div><div>keeps the order of effects reading from left to right, to be consistent with the other applicative combinators as opposed to the other candidate: </div>
<div><br></div><div><div>I think in many ways the strict left to right effect evaluation order is what makes Applicative code readable. You don&#39;t have to reason piecemeal about the order of effects.</div><div><br></div>
</div><div>Both the naive flip (&lt;*&gt;) and your proposed</div><div><br></div><div>flip (liftA2 (flip ($)) x y = flip (liftA2 (flip id)) x y = liftA2 (flip id) y x = flip id &lt;$&gt; y &lt;*&gt; x</div></div><div> </div>
<div>sacrifice that important property.</div><div><br></div><div>-Edward Kmett</div></div></div>