On 18-Feb-2000, Brian Boutel <[EMAIL PROTECTED]> wrote:
> 
> OK,  I understand now. But what advantage does explicit control of instance 
> import/export give you over the current Haskell rule?

It's just a question of information hiding.
It lets you declare a type to be an instance of a public type class
without exporting that fact (and hence exporting those methods).

> In Haskell, you can have at most 1 C-T instance, and that is visible in 
> every module in the program which can be reached by a chain of 
> import/export declarations from the declaring module.
> In Mercury you can have at most 1 C-T instance, but there may be more 
> places where it is not visible. There does not seem to be anything you can 
> do in those places that you could not do if the C-T instance were visible 
> there.

You could say the same about e.g. abstract data types.
The advantage is that the author of module A can ensure that
module B will not access the private parts of module A.
Certainly there's nothing more you could do in module B
than if those parts were public, indeed what you can do is strictly
less.  But the whole point of making things private is to *restrict*
what other modules can do with them.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to