
5 Jul
2012
5 Jul
'12
8:10 a.m.
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
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.