FiniteMap performance WITHOUT any copying?

Peter Thiemann thiemann@informatik.uni-freiburg.de
10 Feb 2003 10:26:23 -0800


Perhaps you should look at the Clean languages, which is similar to
Haskell, but has a feature called "uniqueness typing". Using the type
system, you can figure out the information that you are asking for and
as far as I know, their implementation is optimzed in the manner you
want. In fact, their whole IO system is built around that idea. Have a
look at 

http://www.cs.kun.nl/~clean/

-Peter

    ML> Now, Haskell has a garbage collector, so Haskell must know how many
    ML> pointers there are to all objects in the heap (or?). Then, if a finite map
    ML> for example only has one single pointer to it, then it ought to be all
    ML> right to modify the finite map (or whatever datastructure we are
    ML> considering), I mean really modify the map without making any copies, just
    ML> like in imperative languages. Perhaps there might be pointers to nodes
    ML> inside the tree and I guess that could complicate the matter somewhat. But
    ML> for Haskell arrays it ought to be possible to really modify the array if
    ML> it is used by only one pointer ?

    ML> Are such optimizations possible, and if they are, are they already
    ML> implemented in for example GHC ? Or am I wrong somewhere ?