[Haskell-cafe] MonadMemory class

Mads Lindstrøm mads_lindstroem at yahoo.dk
Fri Mar 28 11:48:52 EDT 2008


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!




More information about the Haskell-Cafe mailing list