Data.Map, Data.IntMap documentation

Adrian Hey ahey at iee.org
Sat Aug 18 06:39:46 EDT 2007


Isaac Dupree wrote:
> Adrian Hey wrote:
>> apfelmus wrote:
>>> The Ord-constraint is too limiting for tries. 
>>
>> Well it isn't going to disappear while I'm in charge of GT class :-)
>> Why do you object to it? Ultimately we must be able to test keys
>> for equality at least. Is there a type that is an instance of Eq,
>> but not Ord (or could not reasonably be made an instance of Ord)?
> 
> STRef and similar, I think are in Eq but would need performance 
> penalties to be in Ord, since they essentially only contain a pointer to 
> their contents, and garbage collection can move and re-order them and 
> their contents.

I guess anyone who wants an STRefMap will just have to suffer the
performance penalty of O(n) lookup and make STRefMap an instance of
some other map class (there are plenty to choose from :-)

Regards
--
Adrian Hey



More information about the Libraries mailing list