[Haskell-cafe] Space questions about intern and sets

Gracjan Polak gracjan at acchsh.com
Thu Jun 2 04:38:00 EDT 2005

Marcin 'Qrczak' Kowalczyk wrote:
 > Gracjan Polak <gracjan at acchsh.com> writes:
 >>intern :: Ord a => a -> a
 >>intern x = unsafePerformIO $ internIO x
 >>iorefset :: Ord a => IORef(Map.Map a a)
 >>iorefset = unsafePerformIO $ do
 >>     newIORef $ Map.empty
 > It will not work because you can't put values of different types as
 > keys of the same dictionary, as you can't compare them.

I could have as many dictionaries as there are types. The problem is I 
get one dictionary for each object which defeats the idea.

Is there any other way to safe some memory when having many same objects?


More information about the Haskell-Cafe mailing list