Last active
October 4, 2017 15:42
-
-
Save wilbowma/69307d684769e78bf2da82b874e5caaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-syntax (typed-axiom syn) | |
(syntax-parse syn | |
#:datum-literals (:) | |
#:with c (format-id syn "constant:~a" #'name #:source #'name) | |
#:with name- (format-id syn "~a-" #'name #:source #'name) | |
[(_:id name:id : type) | |
(define name-ls (parse-telescope-names #'type)) | |
(define type-ls (parse-telescope-types #'type)) | |
(define result (parse-telescope-result #'type)) | |
#`(begin | |
(struct c (#,@name-ls) #:transparent #:reflection-name 'name) | |
(define-syntax name (make-rename-transformer (assign-type #'name- #'type))) | |
; (define-syntax name (lambda (syn) (assign-type #'name- #'type))) | |
(define- name- ((curry c)))])) | |
(begin-for-syntax | |
(define (parse-telescope-name type) | |
(syntax-parse type | |
[(Pi (x : t) telescope) ...] | |
[result ....]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment