[Haskell-beginners] Parsec

Daniel Fischer daniel.is.fischer at web.de
Fri Aug 6 15:25:16 EDT 2010

On Friday 06 August 2010 21:02:48, C Gosch wrote:
> Ah wait ... I saw that I can get the input stream with
>    getParserState,
> as it is part of the state. If that is the currently remaining stream, I
> could use any functions from ByteString
> to skip over some parts or do whatever with them, and update the state
> to the last position after the part I want
> to skip.
> Am I correct there, or am I then getting something in Parsec out of
> sync? Guess I'll just try :)
> Thanks!
> Christian

I think using getInput and setInput would be more convenient.
- parse text
- bs <- getInput
- let (binaryResult, remainingInput) = treatBinaryPart bs
- setInput remainingInput
- continue parsing

More information about the Beginners mailing list