[Haskell-cafe] Parsec and network data

Donn Cave donn at avvanta.com
Fri Aug 29 18:18:05 EDT 2008

Quoth Johannes Waldmann <waldmann at imn.htwk-leipzig.de>:
| I think the following is analoguous.
| Imagine you're writing a parser for a simple programming language.
| A program is a sequence of statements.
| Fine, you do "readFile" (once) and then apply a pure Parsec parser.
| Then you decide to include "import" statements in your  language.
| Suddenly the parser needs to do IO. Assume the import statements
| need not be the first statements  of the program
| (there may be headers, comments etc. before).
| Then you really have to interweave the parsing and the IO.

I think "readFile" might be where the analogy fails.  In a network
client like we were talking about, it's understood that you have to
interweave the parsing and I/O, to some extent.  From this point
of view, I don't see a problem with this programming language parser,
in fact I suppose I might indeed do it that way - maybe map the
file to a ByteString or something, would have to think about it.

	Donn Cave, donn at avvanta.com

More information about the Haskell-Cafe mailing list