
On Fri, 2005-06-03 at 10:53 +0200, Gracjan Polak wrote:
As intern behaves like id and does not have any side effects, I thought its interface should be purely functional. But I do not see any way to do it :( I'll end up with a monad, probably.
In related question: does anybody here have experience/benchmarks/tests how/if is PackedString better (uses less memory) than String in parsing tasks?
GHC itself uses a rather low level thing it calls FastString which is basically a pointer into a character array with a length and a unique id. The unique ids are allocated by entering each FastString into a global hash table which also provides sharing if the same string is seen more than once (like your itern feature). It is all very low level and ghc-specific however and probably only makes sence in a compiler-like application. Duncan