mapM_ for bytestring

Artyom Kazak yom at
Sun Sep 1 20:45:57 CEST 2013

On Sun, 01 Sep 2013 17:16:49 +0400, Henning Thielemann  
<lemming at> wrote:

>> Yeah, the signatures for mapM_ and mapM would respectively be
>>     mapM_ :: Monad m => (Word8 -> m b)     -> ByteString -> m ()
> This one should not be a big problem, but could be done by calling mapM_  
> on the result of ByteString.unpack.

As I’ve said, mapM_ through ByteString.unpack is four times slower than  
the hand-written version. I find it unacceptable that a simple counting  
sort *can’t* be written efficiently for ByteString without importing  
Data.ByteString.Unsafe, Foreign.Ptr and friends.

More information about the Libraries mailing list