
4 Sep
2007
4 Sep
'07
2:07 p.m.
Donald Bruce Stewart writes:
hGet :: Handle -> ByteString -> IO ByteString hGet h buf = do i <- Str.unsafeUseAsCStringLen buf (\(p,n) -> hGetBuf h p n) return (Str.unsafeTake i buf)
That's a useful benchmark. Thanks for looking into this.
It was a pleasure. How do you feel about providing this kind of input API to the user as part of the module? Note that the current hGet can be implemented on top of the combinator above, but the reverse is not true. So I guess that this API is strictly more powerful than the one we currently have. And for some use cases, it's significantly faster too. By the way, did you receive my e-mail about the race condition in readFile? Best regards, Peter