
On Tue, Mar 06, 2007 at 08:49:25PM +0100, Alfonso Acosta wrote:
Did you try to compile with -fallow-overlapping-instances
Same effect: ghc -fallow-overlapping-instances --make test5.lhs [1 of 1] Compiling Main ( test5.lhs, test5.o ) test5.lhs:22:1: Duplicate instance declarations: instance [overlap ok] (Succ a b) => GT a b -- Defined at test5.lhs:22:1 instance [overlap ok] (Succ a b, GT b c) => GT a c -- Defined at test5.lhs:23:1 Does it work with another compiler version?
On 3/6/07, mm
wrote: Hello,
I was thinking that it could maybe be useful to allow duplicate instance declarations, if the class has no methods. From my naive point of view, i can not see problems, scince there are no conflicting methods to choose from. But the following program fails to be compiled by ghc-6.6:
{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-}
class GT a b class Succ a b
data Zero data One data Two data Three
instance Succ One Zero instance Succ Two One instance Succ Three Two
instance Succ a b => GT a b instance (Succ a b, GT b c) => GT a c
The former two lines lead to:
test5.lhs:22:1: Duplicate instance declarations: instance (Succ a b) => GT a b -- Defined at test5.lhs:22:1 instance (Succ a b, GT b c) => GT a c -- Defined at test5.lhs:23:1 _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users