four more CoreSyn questions
Adam Megacz
megacz at cs.berkeley.edu
Mon Mar 7 02:23:44 CET 2011
Simon Peyton-Jones <simonpj at microsoft.com> writes:
> | I assume this is only the
> | value variables, and that the type/coercion variables come from
> | DataCon.{dataConExTyVars,dcEqSpec}, right?
>
> Not so at all. Why did you assume that?
You're right, that was a silly assumption. However, without it, I have
another question:
> 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.
> The variables in Datacon.dataConExTyVars are 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?
> They are the same in number and kind but not necessarily identity.
Ah, that helps!
> tycon T a b
> datacon MkT :: forall p q. T p q
> the p,q in the MkT might not be identical to the a,b stored in the
> TyCon. Why should they be -- the result is alpha-equivalent
Ah, I see: getTyConTyVars gives you a list of variables bound by the
tycon declaration, whereas dcUnivTyVars tells you how they are
instantiated in the type of a particular datacon.
- a
More information about the Cvs-ghc
mailing list