[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two problems



Original-Via: uk.ac.ukc; Tue, 29 Jan 91 22:07:01 GMT
From: Lennart Augustsson <augustss>
Date: Tue, 29 Jan 91 21:58:09 +0100
To: simonpj@cs.glasgow.ac.uk
Cc: haskell@cs.glasgow.ac.uk, s.blott@cs.glasgow.ac.uk
In-Reply-To: Simon L Peyton Jones's message of Tue, 29 Jan 91 09:03:45 +0000 <27565.9101290903@tutuila.cs.glasgow.ac.uk>
Subject: Re: Two problems 
Original-Sender: augustss%se.chalmers.cs@sunic.sunet.se
Sender: haskell-request@cs.glasgow.ac.uk

> For example, suppose you defined multiplication on pairs in one
> module in one way, and in another in another, and then imported both
> modules into a third.  How do pairs multiply now?  Or are these instances
> purely local to a module (seems a pity)?  If so, how can instances 
> ever get exported?
I did not want my local instance declarations to be exported, I would be quite
satisfied (for the moment) if I could make an instance declaration in a module
(not containing the class&type declaration) and use it just in that module.
I.e. I would like to change the visibility rules to say that an instance declaration
is exported only if it is the same module as the class and/or type declaration.

> It is clearly getting hard to decide which instance applies.  Again 
> maybe one could come up with a consistent design, but Haskell is
> complicated enough already, and our brains became incapable of
> figuring out all the ramifications.  Well thought-through proposals
> for Haskell 2 most welcome!
Well, it's not so well thought-through, but what I'm testing in Haskell B is to
allow nested constructors in instance declarations and if several instances
applies the most specific is used.  If there is not a most specific one the
compiler will complain.

	-- Lennart