Proposal: add Int indexing functions to Data.Set
Luis Casillas
luis at casillas.org
Sun May 1 02:46:33 CEST 2011
El abr 30, 2011, a las 2:45 p.m., wren ng thornton escribió:
> So why not just implement your "set" with a map from elements to their indices? Maps maintain uniqueness of keys, and Data.Map maintains ordering too. It wouldn't be as clean as the proposed functions, but from your description of the problem, it's not clear to me that using sets of proxies for array indices is really the cleanest approach in the first place.
Well, maps from elements to indexes was exactly the solution I had in mind at first, but then I looked at the docs for Data.Map and noticed that it had these Int index functions that did the trick for free, and that they were "missing" from Data.Set. So I thought, hey, maybe can I fix that... :-)
More information about the Libraries
mailing list