Lecture Board Images

Motivation

poly type systems motivation 1
poly type systems motivation 2
poly type systems motivation 3
poly type systems motivation 4
poly type systems motivation 5
poly type systems motivation 6

Programming in Typed uScheme

typed uscheme 1
typed uscheme 2
typed uscheme 3
typed uscheme 4

Note

On the board, I incorrectly used val or val-rec relative to how they are defined in the "real" Typed μScheme. A val-rec needs to be given a type annotation and can only be used with a lambda-expression. The type annotation is necessary for type checking (because we must record the name in the typing environment with its type in order to check recursive uses). The restriction to lambda-expressions is simple, but it could be relaxed to zero or more type-lambda expressions around a lambda-expression. The examples would be better written as:

(val-rec [ length : (forall ('a) ((list 'a) -> int)) ]
  (type-lambda ('a)
    (lambda ([ xs : (list 'a) ])
      (if ((@ null? 'a) xs)
          0
          (+ 1 ((@ length 'a) ((@ cdr 'a) xs)))))))

(val-rec [ map : (forall ('a 'b) (('a -> 'b) (list 'a) -> (list 'b))) ]
  (type-lambda ('a 'b)
    (lambda ([ f : ('a -> 'b) ] [ xs : (list 'a) ])
      (if ((@ null? 'a) xs)
          (@ '() 'b)
          ((@ cons 'b) (f ((@ car 'a) xs)) ((@ map 'a 'b) f ((@ cdr 'a) xs)))))))

(val o ; compose
  (type-lambda ('a 'b 'c)
    (lambda ([ f : ('b -> 'c) ] [ g : ('a -> 'b) ])
      (lambda ([ x : 'a]) (f (g x))))))

Typed uScheme Typing Judgements and Rules

typed uscheme type rules 1
typed uscheme type rules 2
typed uscheme type rules 3
typed uscheme type rules 4

Motivate capture avoiding substitution

motivate capture avoiding substitution

Kinds

kinds 1
kinds 2