Is there a more-robust FiniteMap?

Johannes Waldmann
Mon, 25 Feb 2002 09:38:53 +0100 (MET)

> Using FiniteMap, I often run into robustness problems.  

same (?) here! a student of mine recently came across a similar problem
(with a hand-made search tree): he expected to run

  listToFM $ [(0, ()) | i <- [0..100000]]

in constant space, but instead it took all the stack and/or heap.
we made the data constructors strict, and used strict fold for insertion.
this helped with ghc (but not wih hugs).

are there cases where non-strict behaviour of a finite-map implementation
is useful? I can't think of any (analogy: there is no lazy sorting either)
- so perhaps the above suggestions should be take as defaults? 

perhaps ghc already does this (by specializing) when it uses FiniteMap.lhs.

regards -
-- Johannes Waldmann ---- --
-- -- phone/fax (+49) 341 9732 204/252 --