2011/7/22 Simon Peyton-Jones <simonpj@microsoft.com>
I talked to Dimitrios. Fundamentally we think we should be able to handle recursive superclasses, albeit we have a bit more work to do on the type inference engine first.
The situation we think we can handle ok is stuff like Edward wants (I've removed all the methods):
class LeftModule Whole m => Additive m
class Additive m => Abelian m
class (Semiring r, Additive m) => LeftModule r m
class Multiplicative m where (*) :: m -> m -> m
class LeftModule Natural m => Monoidal m
class (Abelian m, Multiplicative m, LeftModule m m) => Semiring m
class (LeftModule Integer m, Monoidal m) => Group m
class Multiplicative m => Unital m
class (Monoidal r, Unital r, Semiring r) => Rig
class (Rig r, Group r) => Ring rThe superclasses are recursive but
a) They constrain only type variables
b) The variables in the superclass context are all
mentioned in the head. In class Q => C a b c
fv(Q) is subset of {a,b,c}
Question to all: is that enough?