warcEntry = do
header <- warcHeader
crlf
body <- do
contentLength <- getContentLength header
compressionMode <- getCompressionMode header
warcbody contentLength compressionMode
crlf
crlf
return (WarcEntry header body)
If you accept crlf as "carriage-return-line-feed", the rest basically reads as pseudocode. crlf could have just as easily been written (string "\r\n") I guess.Parser combinators can:
* call out to other parsing functions (e.g. warcHeader) - so you can build your code out of testable units.
* bind results to variables and start using them during the parse, e.g. warcHeader returns data containing contentLength and compressionMode, which is then fed to the warcbody function so it knows what to expect.