Haskell binary analysis

I have been trying to implement a protocol parser in Haskell, I am very new to this language, especially when it comes to monads. I have been using binary-0.5.0.2 and describe​ ​The header and all payloads of my protocol. The message I want to parse is similar to the following: header (payload A, payload B,…) The fields in the header specify which type of payload the message has. < p>

I have successfully parsed the first message in the bytestring, but I am at a loss as to how to read the next message and discarded the bytes read when processing the first message.< /p>

This may be quite vague, but I would rather get the input of a generic parser than let my ugly code change to work this way.

Thank you for your help

Just use a series of parsing operations and they will consume input.

parseAll = do
hdr <- parseHeader
pa <- parsePayloadA
pb <- parsePayloadB
...

< /div>

I have been trying to implement a protocol parser in Haskell, I am very new to this language, especially when monad is involved. I have been using binary-0.5.0.2 and describe it​​ The header and all payloads of my protocol. The message I want to parse is similar to the following: header(payload A, payload B,…) The fields in the header specify which type of payload the message has.

I have successfully parsed the first message in the bytestring, but I am at a loss as to how to read the next message and discarded the bytes read when processing the first message.

p>

This may be quite vague, but I would rather get the input of a generic parser than let my ugly code change to work this way.

Thank you for your help< /p>

Just use a series of parsing operations, and they will consume input.

parseAll = do
hdr <- parseHeader
pa <- parsePayloadA
pb <- parsePayloadB
...

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2469 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.