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
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
Hello Ariel,
Friday, March 28, 2008, 1:02:39 AM, you wrote:
class (Monad m) = MonadMemory m r | m - r where
there are more than one way to define such class. look at
http://haskell.org/haskellwiki/Library/ArrayRef for examples
--
Best regards,
Bulatmailto:[EMAIL
On Fri, 2008-03-28 at 00:02 +0200, 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
On 3/27/08, Ariel J. Birnbaum [EMAIL PROTECTED] wrote:
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?
Here's some thoughts:
(~=) means equivalent excluding
look at http://haskell.org/haskellwiki/Library/ArrayRef for examples
Thanks, Data.Ref.Universal looks just like it!
One question though. In:
class (Monad m) = Ref m r | m-r, r-m where
Why is the second fundep necessary?
--
Ariel J. Birnbaum
___
This has come up a few times and been written by many Haskellers
I was quite certain of that, hence my puzzlement at being unable to find it =)
What kind of axioms should an instance of this class satisfy?
There are quite a few obvious ones, but I'm not sure it's particularly
necessary.
I'm
(write r x = read) == (write r x return x)
You probably mean (write r x read r) == (write r x return x)?
3) References are independent:
If m does not refer to r, then:
(read r = (\x - m return x)) == m read r
(write r x m) == m = (\v - write r x return v)
What if m writes to r' which
On 3/27/08, Ariel J. Birnbaum [EMAIL PROTECTED] wrote:
(write r x = read) == (write r x return x)
You probably mean (write r x read r) == (write r x return x)?
Yes. Oops!
3) References are independent:
If m does not refer to r, then:
(read r = (\x - m return x)) == m read r