<p dir="ltr">I did use that a couple of times (`xor`ing 2 ByteStrings together), and was surprised by the omission back then, but IIRC (can't validate now), there's a specialised zipWith (as proposed) in the module (with some other name, obviously), which is not exported, but used when you 'pack' the result of 'zipWith' when the result is '[Word8]'... You might want to look into that.</p>
<p dir="ltr">Nicolas</p>
<div class="gmail_quote">On Sep 12, 2013 8:11 PM, "John Lato" <<a href="mailto:jwlato@gmail.com">jwlato@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Carter: we don't have both. We have one function from each category. My guess is nobody's ever really needed a really fast zipWith :: (Word8->Word8->Word8) -> ByteString -> ByteString -> ByteString; that's the only reason I can think of for its omission.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 12, 2013 at 10:45 AM, Carter Schonwald <span dir="ltr"><<a href="mailto:carter.schonwald@gmail.com" target="_blank">carter.schonwald@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Scott: benchmark the two and you'll see why we have both :-)<div><div><span></span><br><br>
On Thursday, September 12, 2013, Scott Lawrence wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, 12 Sep 2013, Tom Ellis wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Sep 12, 2013 at 09:21:20AM -0400, Scott Lawrence wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Something's always bothered me about map and zipWith for ByteString. Why is it<br>
<br>
map :: (Word8 -> Word8) -> ByteString -> ByteString<br>
<br>
but<br>
<br>
zipWith :: (Word8 -> Word8 -> a) -> ByteString -> ByteString -> [a]<br>
</blockquote>
<br>
Well, what if you wanted to zipWith a function of type "Word8 -> Word8 -><br>
Foo" instead of "Word8 -> Word8 -> Word8"?<br>
</blockquote>
<br>
Then I would do what I do with map, and call `unpack` first.<br>
<br>
Either of the two options is usable:<br>
<br>
map :: (Word8 -> Word8) -> ByteString -> ByteString<br>
zipWith :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString -> ByteString<br>
(or)<br>
map :: (Word8 -> a) -> ByteString -> [a]<br>
zipWith :: (Word8 -> Word8 -> a) -> ByteString -> ByteString -> [a]<br>
<br>
I just don't understand why we have one from each.<br>
<br>
-- <br>
Scott Lawrence<br>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a>Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
</blockquote>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div>