[Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread Scott Lawrence
Hello all, Something's always bothered me about map and zipWith for ByteString. Why is it map :: (Word8 - Word8) - ByteString - ByteString but zipWith :: (Word8 - Word8 - a) - ByteString - ByteString - [a] ? Obviously they can be transformed into each other with pack/unpack, and as I

Re: [Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread Scott Lawrence
On Thu, 12 Sep 2013, Tom Ellis wrote: On Thu, Sep 12, 2013 at 09:21:20AM -0400, Scott Lawrence wrote: Something's always bothered me about map and zipWith for ByteString. Why is it map :: (Word8 - Word8) - ByteString - ByteString but zipWith :: (Word8 - Word8 - a) - ByteString -

Re: [Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread Tom Ellis
On Thu, Sep 12, 2013 at 09:21:20AM -0400, Scott Lawrence wrote: Something's always bothered me about map and zipWith for ByteString. Why is it map :: (Word8 - Word8) - ByteString - ByteString but zipWith :: (Word8 - Word8 - a) - ByteString - ByteString - [a] Well, what if you

Re: [Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread Artyom Kazak
On Thu, 12 Sep 2013 18:24:24 +0400, Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote: On Thu, Sep 12, 2013 at 09:21:20AM -0400, Scott Lawrence wrote: Something's always bothered me about map and zipWith for ByteString. Why is it map :: (Word8 - Word8) - ByteString -

Re: [Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread Carter Schonwald
Scott: benchmark the two and you'll see why we have both :-) On Thursday, September 12, 2013, Scott Lawrence wrote: On Thu, 12 Sep 2013, Tom Ellis wrote: On Thu, Sep 12, 2013 at 09:21:20AM -0400, Scott Lawrence wrote: Something's always bothered me about map and zipWith for ByteString. Why

Re: [Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread John Lato
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. On Thu, Sep 12, 2013 at 10:45 AM, Carter

Re: [Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread Nicolas Trangez
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

Re: [Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread Thomas DuBuisson
On Thu, Sep 12, 2013 at 12:44 PM, Nicolas Trangez nico...@incubaid.com wrote: 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