commit e243ee065668cdd856349972a1ee83a291da67db parent 95d960267a79ce2544a930721150fb623c4764eb Author: AlexKnauth <alexander@knauth.org> Date: Tue, 3 May 2016 11:00:41 -0400 add ?∀ and ?Λ Diffstat:
| M | tapl/mlish.rkt | | | 19 | +++++++++++++++++++ |
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/tapl/mlish.rkt b/tapl/mlish.rkt @@ -31,6 +31,25 @@ ;; - pattern matching ;; - (local) type inference +;; creating possibly polymorphic types +;; ?∀ only wraps a type in a forall if there's at least one type variable +(define-syntax ?∀ + (lambda (stx) + (syntax-case stx () + [(?∀ () body) + #'body] + [(?∀ (X ...) body) + #'(∀ (X ...) body)]))) + +;; ?Λ only wraps an expression in a Λ if there's at least one type variable +(define-syntax ?Λ + (lambda (stx) + (syntax-case stx () + [(?Λ () body) + #'body] + [(?Λ (X ...) body) + #'(Λ (X ...) body)]))) + (begin-for-syntax ;; matching possibly polymorphic types (define-syntax ~?∀