[Haskell-cafe] Bytestring map/zipWith rationale

Scott Lawrence bytbox at gmail.com
Thu Sep 12 15:21:20 CEST 2013


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 
understand it, the compiler performs sufficient optimizations so that there's 
no performance hit to doing things like (pack $ zipWith xor a b), but it still 
seems inconsistent. Is there a deep reason for this?

-- 
Scott Lawrence

Linux baidar 3.10.9-1-ARCH #1 SMP PREEMPT Wed Aug 21 13:49:35 CEST 2013 x86_64 GNU/Linux



More information about the Haskell-Cafe mailing list