Hello Ashley,

Friday, April 28, 2006, 5:09:07 AM, you wrote:

> You can do two-way fundeps. Can these be done with associated types? For
> instance:

> It might not be a great loss if not.

may be you want to say "it might be a great loss" ?

i'm using two-way fundeps to implement monad-independent algorithms
that uses references. these definitions:

class (Monad m) => Ref m r | m->r, r->m where
    newRef :: a -> m (r a)
    readRef   :: r a -> m a
    writeRef  :: r a -> a -> m ()
instance Ref IO IORef where
    newRef = newIORef
    readRef = readIORef
    writeRef = writeIORef
instance Ref (ST s) (STRef s) where
    newRef = newSTRef
    readRef = readSTRef
    writeRef = writeSTRef

allows me to write algorithms that works in both monads



-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime

Reply via email to