2011/7/22 Simon Peyton-Jones <simo...@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 r > > The 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? >
This would perfectly address all of the needs that I have had! -Edward
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users