I wrote:
Am I missing something?
Yes! In reality, I do not need unsafeSTRef for this at all, using a type suggested earlier by Udo: stToState :: MonadState st m => (forall s. STRef s st -> ST s a) -> m a stToState f = do s <- get let (y, s') = runST (stm f s) put s' return y where stm f s = do r <- newSTRef s y <- f r s' <- readSTRef r return (y, s') This works! Thanks, Udo! -Yitz _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe