[Haskell-cafe] Bytestring map/zipWith rationale

Artyom Kazak yom at artyom.me
Thu Sep 12 16:24:57 CEST 2013


On Thu, 12 Sep 2013 18:24:24 +0400, Tom Ellis  
<tom-lists-haskell-cafe-2013 at 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 -> ByteString
>>
>> but
>>
>>     zipWith :: (Word8 -> Word8 -> a) -> ByteString -> ByteString -> [a]
>
> Well, what if you wanted to zipWith a function of type "Word8 -> Word8 ->
> Foo" instead of "Word8 -> Word8 -> Word8"?

Then why doesn’t map take “Word8 -> a”, but only “Word8 -> Word8”?



More information about the Haskell-Cafe mailing list