Chad Scherrer wrote:
> x = runST $ return 1
>
> y = runST $ do {r <- newSTRef 1; readSTRef r}
>
> Neither of these works in ghci

x = runST (return 1)

y = runST (do {r <- newSTRef 1; readSTRef r})

The escaping s is something to do with rank 2 polymorphism. 
(Search for "rank" in the ghc user guide, for example.)

The hassle is that runST must always be applied to an
argument (e.g. not passed to ($)), and a benefit is that
you're protected from using an STRef you created in the
context of one runST, in the context of another runST.

Regards,
Tom
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to