On Thu, May 20, 2010 at 12:25 PM, Max Bolingbroke
<batterseapower at hotmail.com> wrote:
> "Available instances" are not a natural addition to this list. In
> particular, using that information can cause programs to become
> untypeable when the module or *any module it imports transitively*
> defines a new instance. This leads to programs that are extremely
> fragile in the face of changes in the libraries!
This is an unavoidable consequence of MPTCs being open, is it not? If
data types or function declarations permitted the post facto addition
of new constructors or pattern matches, similar headaches would ensue
due to non-locality of transitive propagation. Clearly open type
classes are useful; open data types and functions would be useful as
well, actually, but it would be madness to permit *only* open
declarations. Yet, that is the situation with type classes.
I wonder: Of cases where overload resolution via available instances
would be reasonable, how many would also make sense as a closed type
class? By comparison, it seems that many uses of OverlappingInstances
are really just trying to express a closed type class with one or more
default instances, akin to functions with _ patterns. I think, though
I'm not certain, that both would be straightforward and non-fragile
for a closed type class.
- C.