[Haskell-cafe] A typeclass for Data.Map etc?

Eugene Kirpichov ekirpichov at gmail.com
Thu Feb 19 05:51:44 EST 2009


Greetings,

Is there a typeclass for mappings with a Data.Map-like interface, with
stuff like: empty, insert, insertWithKey, unionWith etc. ?
And, probably, a similar typeclass for mutable mappings like Data.Hashtable.

Looks like such a thing would be useful; as for now, I see at least
two applications: Data.Map and Data.Trie (bytestring-trie) - it's a
pity that they have rather similar interfaces, but the latter lacks
many methods and some are named in a different way. Also, Data.Map has
some inconsistensies, too: for instance, it has an insertWith' but
lacks a unionWith'. "One typeclass for all" would eliminate these
inconsistencies.

I'm asking mainly because I've been wondering why noone has yet
written a mutable hashtable package with a MArray-like interface, I
wrote a small thing myself and I am unsure as to what interface it
should have.

--
Eugene Kirpichov


More information about the Haskell-Cafe mailing list