Proposal: containers: add indexing operations for Set

Johan Tibell johan.tibell at gmail.com
Thu Jul 5 16:18:10 CEST 2012


On Thu, Jul 5, 2012 at 8:01 AM, Milan Straka <fox at ucw.cz> wrote:
> Agreed. These indexing methods work only for OrderededSet and
> OrderedMap, not for HashMap and HashSet.
>
> If the Data.Set and Data.Map modules were called Data.OrdSet
> and Data.OrdMap, then there would be no problem including the indexing
> API in them. Personally I consider Data.Set to be Data.OrdSet, not
> a generic Set API. If we every create a Set class, the indexing API will
> definitely _not_ be part of it.

I've also considered Map and Set to be OrdMap and OrdSet for quite a
while. If we ever add a type class to abstract over e.g. HashMap and
Map we'd probably call it Data.Map.Class or something.

A potential downside to adding these functions is that I don't know if
we can support them efficiently with a different implementation of
ordered trees than the size-balanced ones. I still think we should add
them though.

-- Johan



More information about the Libraries mailing list