ct-gradual-typing / Papers

The Combination of Dynamic and Static Typing from a Categorical Perspective
10 stars 0 forks source link

TypeChecker lookup #8

Closed michaelto20 closed 8 years ago

michaelto20 commented 8 years ago

How do I access TyCtx inside of typeCheck_aux so I can look up the variable type?

heades commented 8 years ago

You should be able to use ask to get the context, and then you can access the context as you do any other list.

heades commented 8 years ago

Actually, its a map. So you use (!) from Data.Map to get the value of a key.

So if you have the name of a variable, say x, then to get its type from the context you do

ctx ! x = ty