k0001/pipes-attoparsec — pull request #16 by merijn (2014-05-08 09:50:59+00:00)
Title: Stateful parsing loops

I needed a way to do stateful stream parsing, which wasn't possible with pipes-attoparsec as-is. I implemented both a parsedState and parsedStateL which do, essentially, the same as parsed and parsedL but keep state between parses.

I contemplated adding stateful versions of parse and parseL, but I considered this not worthwhile as with single shot parsers like parse/parseL one could easily just "runStateT" the parser before passing it to parse/parseL. The same does not hold for parsed/parsedL as running a stateful parser means these loops need to know how to get state from one parse to the next.

I tried to keep changes to the code minimal, but as a result I feel the step functions are a bit messy. If needed I'm willing to refactor the step function to be a bit cleaner.