Problem with lexically scoped type variables.

Mirko Rahn rahn at ira.uka.de
Mon Oct 2 11:05:13 EDT 2006


> 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