[Haskell-cafe] Re: How efficient is read?

Stephen Tetley stephen.tetley at gmail.com
Sun May 9 06:32:11 EDT 2010


On 9 May 2010 08:45, Paul R <paul.r.ml at gmail.com> wrote:
[SNIP]

>  http://www.haskell.org/haskellwiki/Parsec
>
> in particular :
>
>  - link 1 points to the parsec site, with an almost 10 years old
>   documentation, for a previous major release
>  - link 3 is broken
>
>
> The rest of the page is a bit terse as well. I'm really wondering what
> one should start reading to learn how to parse a stream in haskell.

Hi Paul

The 10 year old documentation is very good though - for my taste,
Parsec 2.0 is the best documented Haskell lib I've seen.

If you want to parse a stream, you don't want Parsec as produces as it
isn't an online parser - online meaning 'streaming' i.e. it can
produce some results during the 'work' rather than a single result at
the end. From the descriptions on Hackage, Parsimony and uu-parsinglib
sound like better candidates; similarly one of the Polyparse modules
provides an online parser.

If you want to learn how to write a streaming parser, pick one of
those - start work and post back to this list if/when you have
problems. Remember that a non-streaming parser is simpler than a
streaming one: you might want to write a version that works on short
input first and your result type has to support streaming (probably
best if it is a list). Also for any parser, but especially an online
one you'll have to be careful to use backtracking sparingly.

Best wishes

Stephen


More information about the Haskell-Cafe mailing list