You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Georges Dupéron edited this page Sep 28, 2017
·
2 revisions
To extend a language, e.g. mlish:
#lang turnstile/lang
(extends turnstile/examples/mlish)
(define-typed-syntax (blah e₁ e₂) ≫
[⊢ e₁ ≫ e₁- ⇒ τ₁]
[⊢ e₂ ≫ e₂- ⇒ τ₂]
----------
[⊢ (new-expression which can use e₁- e₂-)
⇒ (new-result-type which can use τ₁ τ₂)])
Save this file in a package (raco pkg new mypkg on the command-line and save as mypkg/myfile.rkt, then cd mypkg/; raco pkg install). Then write a file using that new, extended language:
#lang s-exp mypkg/myfile
(blah (list 1 2 3) #t) ;; Can also use the things defined by mlish.
To get the pretty representation of a type at compile-time: type→str. So, to define a :type operator which returns the inferred type of its argument as a string: