``Orphan instances'' should be avoided anyway.
wnoise at ofb.net
Wed Aug 13 04:07:33 EDT 2008
On 2008-08-12, Yitzchak Gale <gale at sefer.org> wrote:
> 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
>>> 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.
Or, you can just use newtype.
More information about the Libraries