Robin,
The following does NOT work, because of a duplicate instance declaration
for A:
class A a
class B1 b1
class B2 b2
instance B1 x => A x
instance B2 x => A x -- duplicate instance, won't compile
data T = T
instance B1 T
Yes, this doesn't work and I think there is no GHC extension that supports
this.
The following DOES work, but it requires that I explicitly give instance
declarations of A for all instances of B1 and B2:
class A a
class A a => B1 a
class A a => B2 a
data T = T
instance A T -- I don't want to have to specify this!
instance B1 T
If you replace the instance you don't want to specify with:
instance B1 a => A a
and use the following flags to start ghc:
-fglasgow-exts -fallow-undecidable-instances
You can add other datatypes, and you only have to give an instance for class
B1.
Good luck!
Gerrit
_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell