Proposal: add ByteString support to unix:System.Posix.IO API

Don Stewart dons at galois.com
Tue Mar 1 23:53:02 CET 2011


ganesh:
> Hi,
>
> On 01/03/2011 06:35, Bryan O'Sullivan wrote:
>> Well, wait. That paragraph portion seems to confuse things. At the  
>> very least, it confuses me, because I surely didn't suggest using  
>> concat, as that would be silly. I want to see four entry points for  
>> writing:
>>
>> fdWrite :: Strict.ByteString -> IO Int
>> fdWriteAll :: Strict.ByteString -> IO ()
>> fdWritev :: [Strict.ByteString] -> IO Int -- turn the list into an  
>> iovec, then call writev
>> fdWritevAll :: [Strict.ByteString] -> IO ()
>>
>> People would normally use the 'All' variants, but there are times when  
>> you really do want to know if you've performed a short write so that  
>> you can handle it yourself.
>>
> What's the practical difference between a (lazy) list of strict  
> bytestrings and a lazy bytestring?

Nothing. Lazy ByteStrings are slightly more efficient (avoid one
indirection from the (:) cell).



More information about the Libraries mailing list