Problem with lexically scoped type variables.

Mirko Rahn rahn at ira.uka.de
Mon Oct 2 10:43:24 EDT 2006


Simon Peyton-Jones wrote:

> | t1 = runST (trav f [1..10] (1,52) >>= \ (s::STRef s (Set Int)) -> seen
> s)
> 
> try
> 
> t1 = runST ( (trav f [1..10] (1,52) >>= \ s -> seen s)
> 		:: forall s. ST s [Int] )

No, the problem is that t1 should use another implementation than t2. 
This version cannot discriminate between different implementations 
anymore. (And logically it did not compile.)

In 6.4.2 I can choose the implementation just by type annotation but 
that's now impossible...

> What's interesting about this example is that you aren't trying to bind
> the type variable 's'.  You'd be quite happy to write
> 	\ (s :: STRef _ (Set Int)) -> seen s

> Note the wildcard "_".  Arguably, one could loosen the rules in this
> case.  This is an avenue that I have seen suggested before, but which I
> have, for one, not yet explored.   Maybe others have better ideas.

For me it would exactly solve the problem. So maybe one could 'quick 
hack' it into ghc!?

Regards, MR

-- 
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---


More information about the Glasgow-haskell-users mailing list