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

Daniel Fischer daniel.is.fischer at googlemail.com
Mon Oct 31 23:46:43 CET 2011


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.

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.



More information about the Beginners mailing list