``Orphan instances'' should be avoided anyway.

Yitzchak Gale gale at sefer.org
Tue Aug 12 18:06:26 EDT 2008

Wolfram wrote:
>> Or on purpose --- this is in fact another use of ``orphan instances''
>> I forgot to mention...
>> Indeed --- this is the only way to have different instances
>> for the same class, as long as we do not have something like
>> the ``named instances'' of our Haskell-2001 paper (shameless plug ;-).

Henning Thielemann wrote:
>>> This will likely cause clash with the main instance
>>> sooner or later, if other modules import your custom instance and the main
>>> one.

>> If there are several instances,
>> there is very likely no ``main instance''.

Jonathan Cast wrote:
> If there is no main instance, there should very likely be no instance at
> all.  We already have named instances...
> Confusing this with type classes seems mostly redundant to me.

This argument, or something like it, is raised whenever someone
mentions the need to define multiple instances of a class for the
same type. And it is correct, theoretically.

But in real life, you often need to write code against existing modules
that you can't change. When an existing module exports an instance
that is inconvenient, you can be in deep trouble.

We are desperately in need of a solution to this problem. If not
Wolfram's "named instances", then at least there must be some
way to control the import and export of instances, just as we can
now control the import and export of every other kind of symbol


More information about the Libraries mailing list