# miscellaneous Core questions

Dimitrios Vytiniotis dimitris at microsoft.com
Fri Feb 25 01:58:18 CET 2011

Hi Adam, I am only in a position to speak about the FunTy (EqPred t1 t2) t3 question.

As I've written before, unless I am pretty unaware of transformations someone is performing in the
desugarer or later on, you will never encounter such a type. The type you are looking for is represented by:
ForallTy tv ty3
where  EqPred ty1 ty2 <- tyVarKind tv. At least that's the assumption in the typechecker/constraint solver!
The kind you are looking after is  typeKind ty1, (function typeKind defined rather oddly in types/Coercion.lhs)

This is the story today, at least in the type checker/constraint solver. It is bound to change but
hasn't yet, AFAIK.

Simon, have you changed anything regarding this already?

Thanks!
d-

________________________________________
Sent: Thursday, February 24, 2011 7:08 PM
Subject: miscellaneous Core questions

Here are the leftover questions I had that weren't very urgent (I
kludged my way around most of them and am now going back to clean stuff
up)....

- Can I count on the desugarer and core-to-core passes preserving the
syntactic order of the branches in a (Let (Rec branches) e)?

- It isn't possible for a single Case to have *both* LitAlt's and
DataAlt's, is it?  Seems like any given Case should have only one
or the other (and possibly a DEFAULT).

- In SystemFC1 the (+>)_\kappa operator is indexed by a kind.  If I
encounter this in Core:

FunTy (EqPred t1 t2) t3

I should expect t1 and t2 to have the same kind, and that would be
the kind-index of the (+>)-type-function-constant, right?

- I haven't been able to figure out how to ask GHC for the Kind of a
Type.  I expected to find a "kindOfType" or similar but couldn't
find it in Type.lhs or TypeRep.lhs.  Does GHC know how to compute
the Kind of a Type?

- Is there a way to extract the varType field from a Var?  It doesn't
seem to be exported from Var.lhs; I had to add my own function to that
file so I could access this field in other modules.

- Is it possible to turn a Name (say, of some magic identifier from
PrelNames.lhs) into a global Var outside of GHC's various monads?
I'd like to add a Var for a global name in a core-to-core pass that