four more CoreSyn questions
simonpj at microsoft.com
Mon Mar 7 05:26:00 CET 2011
| > The variables bound in a case alternative are the [b] in CoreSyn.Alt.
| > These binders include all the type variables, coercion variables, and
| > value variables bound in the alternative.
| Are there any rules about the order in which the different types of
| variables appear (e.g., extyvars first, then covars, then valvars)?
| There is a natural order within each of the three sorts dictated by the
| DataCon, but I see ambiguity in how those three lists get merged.
Well, the variables in the CoreSyn.Alt must appear in the same order as they do in the type of the data constructor (omitting the universally quantified variables of course). So if
C :: forall (a:*) (b:*). (a~b) => b -> T a
then a case alternative will bind
[(b:*), (g : a~b), (v:b)]
in that order.
| > The variables in Datacon.dataConExTyVars are irrelevant.
I meant that they are irrelevant in a CoreSyn.Alt, not that they are always irrelevant!
| Hrm, can't they occur in the types of dataConEqTheta like this?
| tycon T a
| datacon FooT :: forall b. forall c. (EqPred b (list c)) -> T b
| I suppose in this example (dataConExTyVars FooT) would be [c], right?
Yes, that's right.
More information about the Cvs-ghc