----- Original Message -----
From: Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 20, 2000 8:58 PM
Subject: Re: Fw: a problem concerning a paper
> Mon, 20 Mar 2000 14:59:26 +0100, Jan Brosius
<[EMAIL PROTECTED]> pisze:
>
> > > let v = runst (newVar True)
> > > in
> > > runST (readVar v)
> > >
> > > Consider the last line ;
>
> Consider the first line before, because it must be typed in order to
> type the last line.
>
> "newVar True" has type "ST s (MutVar s Bool)".
> runST has type "(forall s. ST s a) -> a".
>
> The type of expected argument of runST cannot be matched with the
> type of the actual argument. "ST s (MutVar s Bool)" is not of the
> form "forall s. ST s a" for any type a, because the second argument
> of ST depends on the first, yet "forall s. ST s a" says it does not
Yes , but what if I would say using your own explanation below that s is
not a variable anymore
but that it actually has a certain specific type say s0. In that case ...
but to keep this discussion
in sequence I first need to know if this is correct.
> (a is bound somewhere outside).
>
> 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, for in the paper it is said that "s is free in ...
and so it doesn't match the type of runST ".
I beg to discuss this paper since it is the most recent explanation of the
implementation of runST
that I could download . If I can understand this paper I can understand the
rest too, I think.
Moreover it is important even for those who only uses Haskell98 since the
implementation
of IO a comes from ST RealWorld a .
>
>
> Now, consider the following example:
>
> runST $ do
> v <- newVar True
> return (runST (readVar v))
>
> Here the cause is different. The type of "readVar v" is "ST s Bool".
> Which s? The s that comes from a lambda-bound variable v, because
> readVar requires s from the monad and s from the variable to be the
> same. The lambda is hidden inside the do notation:
>
> runST $
> newVar True >>= \v ->
> return (runST (readVar v))
>
> "ST s Bool" with s taken from the environment does not match
> "forall s. ST s a", because runST requires the s to be free.
So , I think you mean s is no longer a variable but has a certain type say
s0. Or am I wrong ?
But again please let us focus the discussion on the paper. Once I understand
this paper I can go on further.
>
>
> BTW. In GHC and Hugs the names are actually STRef, newSTRef, readSTRef,
> writeSTRef.
Please focus the discussion on the paper. ( By the way several (not all)
compressed archived papers
could not be opened by my Winzip program (I use Windows NT ))
>
> --
> __("< 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-
>
>
>