Re: [Haskell-cafe] Reference monad

2011-03-11 Thread Levent Erkok
On Mar 11, 2011, at 7:37 PM, Luke Palmer wrote: > On Fri, Mar 11, 2011 at 8:18 PM, Joshua Ball wrote: >> Suppose I want the following functions: >> >> newRef :: a -> RefMonad (Ref a) >> readRef :: Ref a -> RefMonad a >> writeRef :: Ref a -> a -> RefMonad () > > I would be delighted to see a pure

Re: [Haskell-cafe] Reference monad

2011-03-11 Thread Luke Palmer
On Fri, Mar 11, 2011 at 8:18 PM, Joshua Ball wrote: > Suppose I want the following functions: > > newRef :: a -> RefMonad (Ref a) > readRef :: Ref a -> RefMonad a > writeRef :: Ref a -> a -> RefMonad () Assuming this is a pure interface, you need one more thing: runRefMonad :: RefMonad a -> a T

[Haskell-cafe] Reference monad

2011-03-11 Thread Joshua Ball
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).