[Haskell-cafe] Re: ByteString/parsec

Christian Maeder Christian.Maeder at dfki.de
Tue Nov 11 11:13:50 EST 2008


Pieter Laeremans wrote:
> fileParser :: Parser Content
> fileParser = do
>     title <- manyTill getInput  (string . pack "\nTITLE\n")
>     author <- manyTill getInput (string. pack "\nTITLE\n")
>     ....
>     return Content title author ...
> 
> But this doesn't work.

"getInput" does not consume any input but just returns the remaining
input. Therefore it is called infinitely often. If your input were
String you could use "anyChar" instead. I don't know how to do it with
ByteString (maybe parsec-3?).

> I get a stack overflow.  Obviously I'm not understanding something here.
> Are there any good examples of open source projects which parse
> ByteString data ?
> 
> thanks in advance,

Cheers Christian



More information about the Haskell-Cafe mailing list