Making Int{Map,Set} polymorphic over the key type

Georg Rudoy 0xd34df00d at gmail.com
Sat Jun 29 17:04:29 UTC 2019


сб, 29 июн. 2019 г. в 12:57, Carter Schonwald <carter.schonwald at gmail.com>:
> Off hand that seems like it’d break every single piece of code that uses those data structures today or at the very least possibly weaken type inference in some cases.

Even if the change would be (disregarding the specific naming) to
change `IntSet` to `IntSetPoly k` and have `type IntSet = IntSetPoly
Int`? I don't have much experience reasoning about this, but looks
like it shouldn't really break much.

> I do think it’d be super to experiment with that as a child package so we can all try it out and see how the ux compares vs the usual approaches people do today

More on formalities, should it be a fork or a separate package with
just intmap/intset or something else?

> One possible gotcha / law that would need to be true for such new types is that the Ord and Eq instanced would have to be the same as INT.  AT least for some parts of the container api.

Great catch! I haven't thought about that.

-- 
  Georg Rudoy


More information about the Libraries mailing list