``Orphan instances'' should be avoided anyway.

Henning Thielemann lemming at henning-thielemann.de
Tue Aug 12 02:55:51 EDT 2008


On Tue, 12 Aug 2008 kahl at cas.mcmaster.ca wrote:

> I just would like to point out that there is nothing inherently bad about
> what GHC calls ``orphan instances''.
>
> From a code structuring point of view,
> I frequently ``consider orphan'' instances
> useful for separation of concerns.

The problem is, that if you have a main instance of a class for a type and
this one is not bundled with either the type or the class, then you are
able to import the type and the class without the main instance (that is,
you can accidentally miss that instance), and thus you are able to define
another instance. This will likely cause clash with the main instance
sooner or later, if other modules import your custom instance and the main
one.


More information about the Libraries mailing list