instance declarations

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
Sun, 9 Dec 2001 12:55:49 +0000 (UTC)


Fri, 7 Dec 2001 11:38:14 -0800, Mark P Jones <mpj@cse.ogi.edu> pisze:

> There's no solid technical reason for this, but Haskell doesn't allow
> it at the moment because there isn't an easy way to name an instance
> declaration.

There is another problem: even if we created a syntax to name them,
if they would not be exported by default then current programs would
have to be changed.

An instance is usually meant to be exported, so even not considering
compatibility it would be tedious to list all those instances in
the export list (unless you want to export every named thing as well
and omit the export list). It's easy to overlook some and the point
when somebody tries to use a particular instance might be far in the
future. Each instance is often a "small" part of an interface.

I agree that the ability to selectively export instances would be good.
Only it's hard to combine with the current policy of exporting all
instances by default.

Perhaps in the future it will be possible to specify the interface
of a Haskell module more formally, with types of exported values
for example. Then we should remember about instances and solve both
problems simultaneously.

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^
QRCZAK