Scott: benchmark the two and you'll see why we have both :-)<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>