Suppose somewhere we have an instance: instance C Int Bool Int
when the first instance decl you have says we also have instance C Int (x,y,Bool) Int in this case, Int + (x,y,Bool) should uniq. specify Int. however, we also have: instance C a (a,c,b) c where, if we let a=Int, b=Bool, c=Char, then we get that Int + (Int,Char,Bool) should uniq. specify Char. these two confict because if, in the first case, we instantiate x to Int and y to Char, then one says that the third param should be a Bool and the other says the third param should be a Char. (or at least this is my understanding -- someone might correct me) - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Wolfgang Jeltsch > Sent: Friday, August 08, 2003 4:33 PM > To: The Haskell Mailing List > Subject: overlapping instances and functional dependencies > > > Hello, > > I have this code: > class C a b c | a b -> c where > f :: a -> b -> c > > instance C a b c => C a (x,y,b) c where > f a (_,_,b) = f a b > > instance C a (a,c,b) c where > f _ (_,c,_) = c > ghci -fglasgow-exts -fallow-overlapping-instances compiles it without > complaint but hugs -98 +o says: > ERROR "ClassProblem.hs":7 - Instances are not consistent > with dependencies > *** This instance : C a (a,b,c) b > *** Conflicts with : C a (b,c,d) e > *** For class : C a b c > *** Under dependency : a b -> c > Can anyone tell me what the reason for this is and, maybe, > how to avoid these > problems with Hugs? > > Wolfgang > > _______________________________________________ > Haskell mailing list > [EMAIL PROTECTED] > http://www.haskell.org/mailman/listinfo/haskell > _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell