Using Ord for keys of maps and sets

Yitzchak Gale gale at sefer.org
Mon Dec 3 09:04:09 EST 2007


I wrote:
>> We could allow for case 3 by not providing any default
>> instances for Indexable.

Henning Thielemann wrote:
> This would obstruct 'start GHCi and play around' sessions, since you
> cannot create a set of something on the fly. (However, GHCi could still be
> adapted.)

Yes. I am suggesting also leaving the current versions
that use Ord, so we are no worse off with that than we
were before, at least.

> Still, later in the above thread, Johannes Waldmann throws in Local
> Instances:
>  http://www.haskell.org/pipermail/libraries/2007-April/007416.html

Ah, yes. That would be great! I would especially like it
for GHCI - in general, not just because of the special case you
mentioned above.

But this has come up before. There are people who
are not sure about this feature, because of
some ambiguous and/or confusing cases that can
come up when you redefine an instance that already
exists in an enclosing context.

And anyway - this is a serious language change.
It will at best take time. Your Indexable class could
be used right now to make a lot of the most common
cases much easier to handle.

-Yitz


More information about the Libraries mailing list