[Haskell-cafe] Re: Suspected stupid Haskell Question

Yitzchak Gale gale at sefer.org
Thu Oct 18 07:17:52 EDT 2007

Hi Chad,

Chad Scherrer wrote:
> I think the stack overflows
> were happening because Map.insertWith isn't strict enough.
> Otherwise I think the code is the same.

They are visibly almost identical - except that you
do an extra lookup to get your strictness, while insertWith'
has internal access and can do it in the same pass.
So using insertWith' should be faster.

> But I would expect intTable to be faster, since it
> uses IntMap,

I'm not sure if that's strictly true. I have never done
any testing, but I get the feeling that the performance
of IntMap may depend on the distribution of the keys.
After some not so good experiences, I abandonned
IntMap and just use Map. Anyone know?

Also - I don't have insertWith' for IntMap.

> and there's no IntMap.insertWith' as of 6.6.1

The mtl package is now independent of GHC.


More information about the Haskell-Cafe mailing list