macrotypes/turnstile/examples/sysf.rkt
Stephen Chang 1c0fa751d6 split out a define-binding-type from define-type-constructor
- 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
2016-10-13 15:20:30 -04:00

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]])