
14 Jun
2008
14 Jun
'08
12:45 p.m.
(Sorry, Sebastiaan, I hit send accidentally)
On Sat, Jun 14, 2008 at 1:18 PM, Sebastiaan Visser
readHttpMessage :: IO (Headers, Data.ByteString.Lazy.ByteString) readHttpMessage = do myStream <- <accept http connection from client> request <- hGetContents myStream header <- parseHttpHeader request bs <- Data.ByteString.Lazy.hGetContents myStream return (header, body)
Why not readHttpMessage = do myStream <- <accept http connection from client> data <- Data.ByteString.Lazy.hGetContents myStream (header, rest) <- parseHttpHeader data return (header, rest) i.e. make parseHttpHeader return the rest of the string it didn't parse? In fact, may I ask why parseHttpHeader is not a pure function? HTH, -- Felipe.