Hi, Suppose I want the following functions:
newRef :: a -> RefMonad (Ref a) readRef :: Ref a -> RefMonad a writeRef :: Ref a -> a -> RefMonad () for some appropriate data Ref = ... Obviously these functions are already satisfied by IORefs and STM. But if I wanted to implement my own (for fun)... would it be possible? Particularly, in a pure way, without unsafePerformIO? runRefMonad :: RefMonad a -> a I could try to do it with a state monad, and keep all of the refs in a Data.Map, but then I would have to solve the garbage collection problem, so that doesn't really work. Josh "Ua" Ball _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
