Problem with lexically scoped type variables.
Simon Peyton-Jones
simonpj at microsoft.com
Tue Oct 3 06:30:02 EDT 2006
Aha. That's a bug. The forall'd type variables of an expression type
signature should scope over the expression.
Thank you -- I'll fix it, though I don't know if it'll get into 6.6 now.
Simon
| -----Original Message-----
| From: Mirko Rahn [mailto:rahn at ira.uka.de]
| Sent: 02 October 2006 16:05
| To: Simon Peyton-Jones
| Cc: glasgow-haskell-users at haskell.org
| Subject: Re: Problem with lexically scoped type variables.
|
|
| > Oh I see. Well, you'd need to put the type annotation for s back in:
| >
| > t1 = runST ( (trav f [1..10] (1,52) >>= \ (s::STRef s (Set Int)) ->
seen
| > s)
| > :: forall s. ST s [Int] )
|
| ...and reach the starting point again. This version gives the same
error
| message as the original one.
|
| But what works is to give some more detailed hints to the type system:
|
| t1S = trav f [1..10] (1,52) :: ST s (STRef s (Set Int))
| t2S = trav f [1..10] (1,52) :: ST s (STUArray s Int Bool)
|
| t1 = runST ( t1S >>= seen )
| t2 = runST ( t2S >>= seen )
|
| This compiles (and works).
|
| Thank's for advice, MR
|
| --
| -- Mirko Rahn -- Tel +49-721 608 7504 --
| --- http://liinwww.ira.uka.de/~rahn/ ---
More information about the Glasgow-haskell-users
mailing list