<div dir="ltr">I'm more than open to switching to a more efficient solution.<div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 17, 2015 at 5:16 PM, David Feuer <span dir="ltr"><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">The implementation could use some work. Something more like this, I think.</p>
<p dir="ltr">(<|>) = foldr (\x k ys -> x : k (drop 1 ys)) id</p>
<p dir="ltr">In pointless silliness, it's even</p>
<p dir="ltr">foldr ((. (. (maybe ([]) snd . uncons))) . (.) . (:)) id</p>
<div class="gmail_quote"><div><div class="h5">On Jul 17, 2015 2:15 PM, "Edward Kmett" <<a href="mailto:ekmett@gmail.com" target="_blank">ekmett@gmail.com</a>> wrote:<br type="attribution"></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">Er.. I obviously meant<div><br></div><div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">instance Alternative ZipList where</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace"> empty = ZipList []</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace"> ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys)</font></div></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace"><br></font></div><div style="font-size:12.8000001907349px"><font face="arial, helvetica, sans-serif">sorry for any confusion.</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 17, 2015 at 11:37 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">The <font face="monospace, monospace">ZipList</font> data type admits one legal <font face="monospace, monospace">Alternative</font> instance<div><br></div><div><font face="monospace, monospace">instance Alternative ZipList where</font></div><div><font face="monospace, monospace"> pure = ZipList []</font></div><div><font face="monospace, monospace"> ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys)</font></div><div><br></div><div>The legality of this instance was first noted in <a href="http://people.cs.kuleuven.be/~tom.schrijvers/Research/papers/ppdp2015.pdf" target="_blank">http://people.cs.kuleuven.be/~tom.schrijvers/Research/papers/ppdp2015.pdf</a></div><div><br></div><div>I propose adding this instance, which acts like a generalized version of the Alternative for Maybe, choosing with a left bias.</div><div><br></div><div>Discussion Period: 2 weeks</div><span><font color="#888888"><div><br></div><div>-Edward</div></font></span></div>
</blockquote></div><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://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div>
</blockquote></div><br></div>