
28 Mar
2008
28 Mar
'08
11:48 a.m.
Hi Ariel J. Birnbaum wrote:
Two questions came to mind while thinking of memory references in Haskell:
1. Is there a "standard" equivalent of the following:
class (Monad m) => MonadMemory m r | m -> r where new :: a -> m (r a) read :: r a -> m a write :: r a -> a -> m ()
I do not think you can call it standard, but TypeCompose http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TypeCompose-0.5 do implement Data.RefMonad, which does what you are describing. Greetings, Mads Lindstrøm
What kind of axioms should an instance of this class satisfy?
2. How would a "pure" instance of this class look like (obvious unsafePerformIO-based solutions aside)? Is it even possible in pure Haskell?
Thanks much!