<div dir="ltr">why not move them totally to the right hand side then?<div><br></div><div>eg </div><div><br></div><div>(*>) = \ u v -> <span style="font-family:arial,sans-serif;font-size:13px">pure (const id) <*> u <*> v</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 2, 2014 at 10:00 AM, Edward Kmett <span dir="ltr"><<a href="mailto:ekmett@gmail.com" target="_blank">ekmett@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It seems to me that lower arity definitions could be a good thing.<div><br></div><div>They'd permit the inliner to pull the definition in in more contexts.</div><div><br></div><div>There is a minor sublety around strictness in your example for Maybe. </div><div><br></div><div>There:</div><div><br></div><div>(<*>) undefined = undefined</div><div><br></div><div>whereas with the normal definition</div><div><br></div><div>(<*>) undefined = const undefined</div><div><br></div><div>But this is one of those rare cases where I don't think anyone can build up a viable argument for where they've ever used that particular bit of laziness, and in fact, the extra eta expansion wrapper has probably been a source of subtle optimization pain for a long time.</div><div><br></div><div>Consider me a tentative +1 unless someone can come up with a deal breaker.</div><div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sun, Nov 2, 2014 at 4:29 AM, David Feuer <span dir="ltr"><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div><div><a href="http://hackage.haskell.org/package/base-4.7.0.1/docs/Control-Applicative.html" target="_blank">http://hackage.haskell.org/package/base-4.7.0.1/docs/Control-Applicative.html</a> says that<br><br>    The other methods have the following default definitions,<br>    which may be overridden with equivalent specialized<br>    implementations:<br><br>    u *> v = pure (const id) <*> u <*> v<br><br><br></div>and<br><br>    If f is also a Monad, it should satisfy<br><br>    ...<br>    (<*>) = ap<br><br><br></div>The (potential) trouble is that these have higher arities than is always natural. For example, it would seem reasonable to say<br><br></div><div>    (<*>) Just f = fmap f<br></div>    (<*>) Nothing = const Nothing<br><br></div>and to replace the default definition of (*>) like so:<br><br>    (*>) a1 = (<*>) (id <$ a1)<br><br></div>but these are not strictly equivalent because they have arity 1 instead of arity 2. Would such definitions be be better in some cases? If so, should we weaken the rules a bit?<br></div>
<br></div></div>_______________________________________________<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>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">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>
<br></blockquote></div><br></div>