<p dir="ltr">I think the answer is almost certainly no. The zipWith will turn into a foldr2, and there's no vaguely sure way of snatching that before it fuses with a build form and is lost forever. You'd end up with some very complicated rules that only did something useful when the phase of the moon was right. I'm pretty sure it's not worth trying.</p>
<div class="gmail_quote">On Oct 22, 2014 4:40 PM, "Ganesh Sittampalam" <<a href="mailto:ganesh@earth.li">ganesh@earth.li</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I see, thanks. Could this be done via a rewrite rule from that idiom to<br>
an internal implementation function instead?<br>
<br>
On 22/10/2014 20:19, David Feuer wrote:<br>
> Yes, they do. In particular, the zip can only fuse with one of the two<br>
> lists so the Ints could be unboxed, or fusion optimizations could happen<br>
> with the list folded over, but not both. The fold_WithIndex function can<br>
> manage both at once. That said, I think there have been some pretty good<br>
> arguments against adding these, or at least against adding them with<br>
> these names.<br>
><br>
> On Oct 22, 2014 3:13 PM, "Ganesh Sittampalam" <<a href="mailto:ganesh@earth.li">ganesh@earth.li</a><br>
> <mailto:<a href="mailto:ganesh@earth.li">ganesh@earth.li</a>>> wrote:<br>
><br>
>     On 16/10/2014 18:14, David Feuer wrote:<br>
><br>
>         These functions can be lifted pretty much straight out of<br>
>         Data.Sequence.<br>
>         In particular, foldrWithIndex makes for a particularly nice<br>
>         expression<br>
>         of a fusing findIndices function, as is present in Data.Sequence.<br>
><br>
><br>
>     Do these do anything better than just adding indicies first with the<br>
>     standard zip [0..] idiom?<br>
><br>
>     Cheers,<br>
><br>
>     Ganesh<br>
><br>
>     _________________________________________________<br>
>     Libraries mailing list<br>
>     <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a> <mailto:<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>
>     <<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a>><br>
><br>
<br>
</blockquote></div>