[Haskell-cafe] Space leak - help needed

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Thu Mar 13 12:52:05 EDT 2008


Krzysztof Kościuszkiewicz wrote:
> I have tried both Poly.StateLazy and Poly.State and they work quite well
> - at least the space leak is eliminated. Now evaluation of the parser
> state blows the stack...
> 
> The code is at http://hpaste.org/6310

Apparently, stUpdate is too lazy. I'd define

    stUpdate' :: (s -> s) -> Parser s t ()
    stUpdate' f = stUpdate f >> stGet >>= (`seq` return ())

and try using stUpdate' instead of stUpdate in incCount.

HTH,

Bertram


More information about the Haskell-Cafe mailing list