[Haskell-cafe] MonadMemory class

Ariel J. Birnbaum valgarv at gmx.net
Thu Mar 27 18:02:39 EDT 2008


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 ()

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!
-- 
Ariel J. Birnbaum


More information about the Haskell-Cafe mailing list