[Haskell-cafe] Re: Processing of large files
Scott Turner
p.turner at computer.org
Wed Nov 3 15:03:13 EST 2004
On 2004 November 03 Wednesday 09:51, Alexander Kogan wrote:
> merge' a x = (addToFM (+) $! a) x 1
> is not strict.
> Can I do something to make FiniteMap strict?
> Or the only way is to make my own StrictFiniteMap?
You can replace
addToFM_C (+) a x 1
with
let a' = addToFM_C (+) a x 1 in
lookupFM a' x `seq` a'
or you can generalize that into your own strict version of addToFM_C. It's a
little ugly, but probably gets the job done.
More information about the Haskell-Cafe
mailing list