<HTML><BODY><p>Hi,</p><p>suppose that there is following data family:</p><p>&gt; data family D a<br>&gt; data instance D Int = DInt Int<br>&gt; data instance D Bool = DBool Bool</p><p>it is not possible to match on constructors from different instances:</p><p>&gt; -- type error<br>&gt; a :: D a -&gt; a<br>&gt; a (DInt x) = x<br>&gt; a (DBool x) = x</p><p>however, following works:</p><p>&gt; data G :: * -&gt; * where<br>&gt; GInt :: G Int<br>&gt; GBool :: G Bool<br>&gt;<br>&gt; b :: G a -&gt; D a -&gt; a<br>&gt; b GInt (DInt x) = x<br>&gt; b GBool (DBool x) = x</p><p>The reason why second example works is equality constraints (a ~ Int) and (a ~ Bool) introduced by GADT's constructors, I suppose.</p><p>I'm curious - why data families constructors (such as DInt and DBool) doesn't imply such constraints while typechecking pattern matching?</p><p>Thanks.</p></BODY></HTML>