Proposal: containers: add indexing operations for Set
nominolo at googlemail.com
Thu Jul 5 14:10:28 CEST 2012
Right, given that Data.Set and Data.Map are de facto implementing
ordered sets/maps, I'm fine with adding the proposed functions. The
documentation should be improved, though.
On 5 July 2012 13:01, Milan Straka <fox at ucw.cz> wrote:
>> I.e., what are the properties of these functions? Do we have:
>> - findIndex a set `compare` findIndex b set ==> a `compare` b
> it is even true that
> - findIndex a set `compare` findIndex b set <==> a `compare` b
> because (flip findIndex set) is a bijection respecting ordering.
>> - findIndex a set == findIndex a (Set.toList set)
> This one holds too. It could be considered a definition of
> Set.findIndex, but the Set.findIndex is more efficient than
> the list version.
Sure. But I believe it's good to have a simple and precise semantic model.
More information about the Libraries