[Haskell-cafe] Parsec question

Ketil Malde ketil+haskell at ii.uib.no
Tue Apr 19 03:47:22 EDT 2005


Hi,

I've started using Parsec for my parsing needs, and must say I'm very
happy with it.  There is one thing that I'm struggling with
implementing though.

Basically, I want to parse a file containing multiple records.  I
already have a parser for a single record, and of course I could parse
the file simply as 

    many record

However, this gives me the type

    Either ParseError [Record]

which AFAICT, requires the whole file to be parsed correctly before
any result is returned.  I think it would be better for my purposes to
have a parser of type

     [Either ParseError Record]

so that the list of Records can be processed in an on-line fashion,
until an error occurs.

Is there an obvious way to achieve this?

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Haskell-Cafe mailing list