Type inference
1 / 96
Subject: Type inference
Readings: Pierce, chapter 22.
2 / 96
The only explicit type annotations in
the typed lambda calculus extended
with natural numbers and Booleans
are on the variables of abstractions.
3 / 96
What if we erase the
(* Q4 : basic type checking *)
type binOp = OpPlus | OpTimes | OpCons
type unOp = OpIsZero | OpHead | OpTail | OpIsEmpty
type myType = T_Int | T_Bool | T_Fun of myType * myType | T_List of myType
type expr = Int of int
| Bool of bool
| If of expr * expr
#lang racket
; An expression is either [var] an alphabetic symbol,
; or [abs] (list ' v e) where v is an alphabetic symbol and e is an expression,
; or [app] (list e1 e2) where e1 and e2 are expressions.
; The following trivial functions make code that u