
2 Jun
2005
2 Jun
'05
9:09 a.m.
On 2005 June 02 Thursday 04:38, Gracjan Polak wrote:
iorefset :: Ord a => IORef(Map.Map a a) iorefset = unsafePerformIO $ do newIORef $ Map.empty
I could have as many dictionaries as there are types. The problem is I get one dictionary for each object which defeats the idea.
To avoid unsafe operations and get control over the dictionaries that are created, I would put the desired dictionaries into a state monad. The type of 'intern' becomes Ord a => a -> DictionaryState a All the code that uses 'intern' would need some modification to deal more directly with the dictionary state. It may be more complex, but it's also more solid.