[Haskell-beginners] Stack space overflow: using strict accumulator still fails

Hugo Ferreira hmf at inescporto.pt
Mon Oct 31 23:59:47 CET 2011


On 10/31/2011 10:46 PM, Daniel Fischer wrote:
> On Monday 31 October 2011, 23:16:55, Hugo Ferreira wrote:
>> BTW, I changed foldlz' to foldlz and used (!)
>
> No good. foldlz needs (in this case) the laziness in the accumulator.
>
>> but still get the stack overflow. Need I do anything else?
>
> You can patch your ListZipper (cabal unpack ListZipper; correct the typo;
> increment version number in ListZipper.cabal; cabal install), then you can
> use foldlz' with a strict accumulator. Or you can use foldlz with a lazy
> accumulator, doesn't make much difference for the brown corpus.
>

Hmmm.... how so? I get stack overflow.
You mean use the RTS options to increase memory.

> Also, in tokenTagFreqs, replace M.insertWith (twice) with M.insertWith',
> you're filling your maps with thunks as is. Evaluating entries on the spot
> reduces time and memory requirements.
>

Will report this to the book's authors.

Thanks once again,
Hugo F.




More information about the Beginners mailing list