Bulat Ziganshin: > Sunday, March 19, 2006, 7:25:44 PM, you wrote: > > >> i had a class which defines "default" reference type for monads: > >> > >> class Ref m r | m->r where > > to be exact, > > class Ref m r | m->r, r->m where > >> newRef :: a -> m (r a) > >> readRef :: r a -> m a > >> writeRef :: r a -> a -> m () > > or even worser: > > class Ref2 m r a | m a->r, r->m > instance (Unboxed a) => Ref2 IO IOURef a > instance (!Unboxed a) => Ref2 IO IORef a > instance (Unboxed a) => Ref2 (ST s) (STURef s) a > instance (!Unboxed a) => Ref2 (ST s) (STRef s) a > > MMTC> My statement remains: Why use a relational notation if you can have a > MMTC> functional one? > > how about these examples?
Bidirectional FDs correspond to associated data types. I am not sure what you try to achieve with your Ref2 example. The dependency of r on a seems to be surious as you don't instantiate a in any of your instance declarations. > MMTC> class Monad m => RefMonad m where > MMTC> type Ref m :: * -> * > > can i use `Ref` as type function? for example: > > data StrBuffer m = StrBuffer (Ref m Int) > (Ref m String) Yes, absolutely. Manuel _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime