[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SYNTAX ONLY: The scope of type variables
Date: 4 Apr 91 13:40
From: haskell-request@cs.glasgow.ac.uk
Sender: Simon L Peyton Jones <simonpj@cs.glasgow.ac.uk>
To: Satish Thatte <satish@sun.mcs.clarkson.edu>
Cc: haskell@cs.glasgow.ac.uk, simonpj@cs.glasgow.ac.uk
Subject: Re: SYNTAX ONLY: The scope of type variables
X-Comment1: #############################################################
X-Comment2: # uk.ac.glasgow.cs has changed to uk.ac.glasgow.dcs #
X-Comment3: # If this address does not work please ask your mail #
X-Comment4: # administrator to update your NRS & mailer tables. #
X-Comment5: #############################################################
| Just to satisfy myself, let me summarize the upshot of the discussion
| from my point of view -- I will then leave decisions with the Gods
| (in the earthly form of the Haskell Committee :-)):
Unfortunately (for me) I have been declared God for the current Haskell
revision.
Like Satish I conclude that while his proposals are attractive (for the
reasons he gives) they are too far-reaching to put in the present
(supposedly minor) revision. So I PROPOSE to put them in the Haskell 2 file.
I also PROPOSE to stick with my proposal to make the predicated type
variables of an instance declarations and class declarations scope over the
inner declarations, despite the disadvantages which Satish points out.
[Incidentally, his "convars" proposal also requires introducing a new
environment to the static semantics.]
The thing which tipped the balance for me was that in @class@ declarations
we just about MUST have scoping for the type variable introduced by the
@class@ decl; and there is no easy way to make that apply to the
signature for the class without it also applying to the declarations
of any default methods as well.
Satish adds:
| For the present, I like Paul's alternative
| of
| just twiddling the syntax so that the instance declaration above is written
|
| instead in the form
|
| (Ix a, Text a, Text b) => instance Text (Array a b) where ...
|
| which makes the intent and scope of the context clearer. Changing the
| class declaration example to
|
| (Real a, Fractional a) => class RealFrac a where ..
|
| is not really good because the context being abbreviated is (RealFrac a)
| rather than (Real a, Fractional a).
I am reluctant to do this:
- it is moot (to me) whether it actually makes things clearer
- for consistency we'd have to do it to @data@ declarations too;
parsing would get a little harder
- the inconsistency with @class@ decls is a little hard to
explain to Joe User
Simon