Tue, 21 Mar 2000 12:31:39 +0100, Jan Brosius <[EMAIL PROTECTED]> pisze:
> > So the first line won't typecheck, and the question whether the last
> > line would typecheck if the first line would becomes irrelevant.
>
> I think it is relevant,
I don't remember what the paper said, but you must typecheck variables
bound in a let before you typecheck the body of the let, and in the
case of any type error the party is over, so I can't see how it could
be relevant.
> for in the paper it is said that "s is free in ...
Sorry, I don't know how to explain it basing on the fact that some
type variable is free - well, the second example shows that it *must*
be free in order to apply runST. In the first example, although it
is free, it is tied to the type of ST result, and the type of runST
requires that we can quantify over the first argument of ST while
keeping the rest of the type independent of the quantified variable.
BTW, ghc's error message is misleading:
Inferred type is less polymorphic than expected
Quantified type variable `s' escapes
It is mentioned in the environment
The following variables in the environment mention `s'
In an expression with expected type: forall s1. ST s1 a
[...]
...it does not list any "following variables".
> So , I think you mean s is no longer a variable but has a certain
> type say s0.
Depends what we call variables. The generally used terminology calls
them variables independently of whether they are free (and thus can
be generalized over) or they are bound outside. Similarly, in
let f x = (let g = x+x in g+g) in ...
the x inside g is still called a variable, although it has a certain
value for a given invocation of g (and even f).
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a22 C+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-