[Haskell-cafe] parsec manyTill stack overflow

Felipe Lessa felipe.lessa at gmail.com
Fri Jul 4 17:11:35 EDT 2008

On Fri, Jul 4, 2008 at 5:31 PM, Badea Daniel <badeadaniel at yahoo.com> wrote:
>> parse (manyTill anyChar eof) "" ['a'|x<-[1..1024*1024]]
> *** Exception: stack overflow

The usual solution applies: move the data from the stack to the heap. Try using

manyTill' act end = go []
    go acc = choice [end >> return (reverse acc)
                    ,act >>= \x -> go (x:acc)]


More information about the Haskell-Cafe mailing list