
- document #:arg-variances and variances; #:arr - fixes #36 - start to split type constructor macro into (not working yet) - ty-: expands to expanded type representation - ty: performs kindchecking and expands to ty- - this makes it easier for programmers to implement their own kind system, but still get some turnstile conveniences like pat expanders
31 lines
598 B
Racket
31 lines
598 B
Racket
#lang turnstile/lang
|
|
(extends "stlc+lit.rkt")
|
|
|
|
;; System F
|
|
;; Types:
|
|
;; - types from stlc+lit.rkt
|
|
;; - ∀
|
|
;; Terms:
|
|
;; - terms from stlc+lit.rkt
|
|
;; - Λ and inst
|
|
|
|
(provide (type-out ∀) Λ inst)
|
|
|
|
(define-binding-type ∀)
|
|
|
|
(define-typed-syntax (Λ (tv:id ...) e) ≫
|
|
[([tv ≫ tv- : #%type] ...) () ⊢ e ≫ e- ⇒ τ]
|
|
--------
|
|
[⊢ e- ⇒ (∀ (tv- ...) τ)])
|
|
|
|
(define-typed-syntax inst
|
|
[(_ e τ:type ...) ≫
|
|
[⊢ e ≫ e- ⇒ (~∀ tvs τ_body)]
|
|
#:with τ_inst (substs #'(τ.norm ...) #'tvs #'τ_body)
|
|
--------
|
|
[⊢ e- ⇒ τ_inst]]
|
|
[(_ e) ≫
|
|
--------
|
|
[≻ e]])
|
|
|