Wow.  One innocent message...

| Oh no, please don't do this! I use the RefMonad class, but 
| *without* the dependency r -> m. Why not? Because I want to 
| manipulate (for example) STRefs in monads built on top of the 
| ST monad via monad transformers. So I use the same reference 
| type with *many different* monads! Your change would make 
| this impossible.

I don't think so.


There were really two parts to my message:

1.  Have a single built-in type (Ref), rather than two (IORef and
STRef).
I don't see how that can be anything other than a Good Thing, can it?
The primitive operations over Refs are still non-overloaded, as before:
        newIORef :: a -> IO (Ref IO a)
        newSTRef :: a -> ST s (Ref (ST s) a)
        ...etc...

2.  Have a RefMonad type class to overload the new, read, write
operations over Refs.   But nothing in my message precludes also
having a RefMonad2 class with two parameters, and whatever 
functional dependencies (or lack of them) that you like

        class RefMonad2 r m where
           new :: a -> m (r a)
           read :: r a -> m a
           write :: r a -> a -> m ()

        instance RefMonad2 (Ref IO) IO where ...
        instance RefMonad2 (Ref (ST s)) (ST s) where ...

So then it's only a question of who gets the name "RefMonad"!
(Incidentally, so far as I know, RefMonad isn't in any of the existing
libraries.)


So I conclude:
        (1) is a win    
        (2) is a question of what we name the new (and undoubtedly
        useful) class that I tendentiously called RefMonad

Or am I missing something?

Simon


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to