Superclass Cycle via Associated Type
Edward Kmett
ekmett at gmail.com
Fri Jul 22 21:06:43 CEST 2011
2011/7/22 Simon Peyton-Jones <simonpj at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20110722/c886b70e/attachment.htm>
More information about the Glasgow-haskell-users
mailing list