[Haskell-cafe] Space questions about intern and sets

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Jun 3 11:02:09 EDT 2005

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.


More information about the Haskell-Cafe mailing list