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

Carter Schonwald carter.schonwald at gmail.com
Sat Jun 29 18:13:40 UTC 2019


make it a tiny little library thats its own! :)

yeah, you'd probably want there to be Eq respecting Coercions flavor and
the Ord respecting flavor

On Sat, Jun 29, 2019 at 1:04 PM Georg Rudoy <0xd34df00d at gmail.com> wrote:

> сб, 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190629/75acb400/attachment.html>


More information about the Libraries mailing list