Tangent: overlapping instances

John Meacham john at repetae.net
Tue Apr 4 16:01:32 EDT 2006

On Tue, Apr 04, 2006 at 01:55:09PM +0100, Ross Paterson wrote:
> Orphan instances are discouraged in the GHC libraries, so there might
> not be much support for adding a feature designed to permit orphan
> derived instances.

This reminds me of something I was thinking about the other day, would
overlapping instances be okay if orphan instances were disallowed on
them? My reasoning is that in order to use any instance the data
constructor must be in scope, therefore all revelant instances are.

A simple rule like "for classes declared as overlapping, when declaring
instances either the class definition must appear in the current module,
or the data constructor at the head of the instance must be declared in
the current module"

the point would be to solve the unacceptable "importing a module might
silently change behavior" problem with general overlapping instances


John Meacham - ⑆repetae.net⑆john⑈

More information about the Haskell-prime mailing list