Guest User

Untitled

a guest
Oct 22nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. function inferLet(ctx: Context, expr: ELet): [Type, Substitution] {
  2. const [rhsType, s1] = infer(ctx, expr.rhs);
  3. const ctx1 = applySubstToCtx(s1, ctx);
  4. const rhsPolytype = generalize(ctx1.env, rhsType);
  5. const ctx2 = addToContext(ctx1, expr.name, rhsPolytype);
  6. const [bodyType, s2] = infer(ctx2, expr.body);
  7. const s3 = composeSubst(s1, s2);
  8. return [bodyType, s3]
  9. }
Add Comment
Please, Sign In to add comment