Skip to content

Instantly share code, notes, and snippets.

@wilbowma
Last active October 4, 2017 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilbowma/69307d684769e78bf2da82b874e5caaa to your computer and use it in GitHub Desktop.
Save wilbowma/69307d684769e78bf2da82b874e5caaa to your computer and use it in GitHub Desktop.
(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