
[switching to libraries] On Thu, Nov 13, 2003 at 04:29:49PM -0500, Derek Elkins wrote:
Sorry that I'm too lazy to download the the tar.bz2 and see for myself, but...
On Thu, 13 Nov 2003 16:06:24 -0500 "Abraham Egnor"
wrote: that applies those functions to a monadic reference. Instances for MRef are provided for both IORef and STRef.
Assuming MRef is like the below, did you include Lazy.ST too?
On a more general note, sticking something like MonadRef somewhere in the heirarchical libs seems like it would be useful. Or perhaps Iavor's monad library?
instance MonadRef IO IORef where newRef = newIORef readRef = readIORef writeRef = writeIORef
instance MonadRef (Lazy.ST s) (STRef s) where newRef = Lazy.strictToLazyST . newSTRef readRef = Lazy.strictToLazyST . readSTRef writeRef = (Lazy.strictToLazyST .) . writeSTRef
instance MonadRef (Strict.ST s) (STRef s) where newRef = newSTRef readRef = readSTRef writeRef = writeSTRef
For an alternative design, see http://haskell.org/pipermail/libraries/2003-September/001411.html