> A simple irregular type is > Irr a = Con a (Irr (F a)) > (as long as F uses a) > > The sort of instance I'm interested in is something like > instance (Eq a,Eq (Irr (F a)) => Eq (Irr a) > where the context only mentions (subexpressions of) type expressions > encoutered while expanding the type. > > Are you using anything like this? >
In Haskell terms (making things slightly more general): data Irr a f = Con a (Irr (f a)) instance (Eq a,Eq (Irr (f a)) => Eq (Irr a f) The above instance is inherently dangerous (cause context reduction becomes non-terminating). I haven't seen the code attached to the instance. My guess is that if you could state something like the following instance (Eq a, (forall b. Eq b => Eq (f b))) => Eq (Irr a f) then your code type checks. Note that the above instance declaration is terminating. Unfortunately, such an extension does not exist at the moment. However, you can encode the above in ordinary Haskell. Check out Valery Trifonov's Haskell'03 paper "Simulating Quantified Class Constraints". Martin _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell