I've looked around at the various STRef examples out there, but still nothing I write myself using this will work. I'm trying to figure out how the s is escaping in really simple examples like
x = runST $ return 1 y = runST $ do {r <- newSTRef 1; readSTRef r} Neither of these works in ghci - they both say <interactive>:1:0: Inferred type is less polymorphic than expected Quantified type variable `s' escapes Expected type: ST s a -> b Inferred type: (forall s1. ST s1 a) -> a In the first argument of `($)', namely `runST' In the definition of `it': ... I thought maybe I needed to replace 1 with (1 :: Int) so the state representation didn't force the type, but it still gives the same result. Can someone point me to the simplest possible runST example that actually works? Thanks! -- Chad Scherrer "Time flies like an arrow; fruit flies like a banana" -- Groucho Marx _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe