Hacker News new | ask | show | jobs
by tmorgan 5459 days ago
Yes, the argument presented for point one is pretty weak, but I do agree with it. Having the lazy I/O, and especially lazy bytestring option is great IMO. Although Oleg style left-fold enumerators as used by warp are superior in many respects, typically as a user you don't need to interact at that level; iirc you don't in Yesod, which is built on warp. As an example of approachability LBS approach, checkout this two line "wc -l" implementation, which beats "wc -l" by 64x, apples and pears no doubt, but shows fast enough,(from http://www.mail-archive.com/haskell@haskell.org/msg18878.htm...):

> import qualified Data.ByteString.Lazy.Char8 as L

> main = L.getContents >>= print . L.count '\n'

edit: actually it beats "wc", and is roughly same speed as "wc -l".

1 comments

That's really cool, and is the kind of good benchmark I was referring to. I'm curious to see how it compares to an iteratee approach. I suspect in this case that there wouldn't be much of a difference, because iteratees are suited especially well for handling multiple concurrent streams, and this deals with only one.