macrotypes/tapl/sysf.rkt
Stephen Chang bf126449b4 define-type-constructor supports annotated bound vars
- use this to impl forall in fomega
- define-type-constructor default arity is =1
- define explicit normalize fn in fomega -- speeds up tests 15%
- move same-type to define-syntax-category
2015-10-09 16:59:48 -04:00

24 lines
617 B
Racket

#lang s-exp "typecheck.rkt"
(extends "stlc+lit.rkt")
(reuse #:from "stlc+rec-iso.rkt") ; want this type=?
;; System F
;; Type relation:
;; - extend type=? with ∀
;; Types:
;; - types from stlc+lit.rkt
;; - ∀
;; Terms:
;; - terms from stlc+lit.rkt
;; - Λ and inst
(define-type-constructor #:bvs >= 0)
(define-typed-syntax Λ
[(_ (tv:id ...) e)
#:with ((tv- ...) e- τ) (infer/tyctx+erase #'([tv : #%type] ...) #'e)
( e- : ( (tv- ...) τ))])
(define-typed-syntax inst
[(_ e τ:type ...)
#:with (e- (tvs (τ_body))) ( e as )
( e- : #,(substs #'(τ.norm ...) #'tvs #'τ_body))])