From e243ee065668cdd856349972a1ee83a291da67db Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Tue, 3 May 2016 11:00:41 -0400 Subject: [PATCH] =?UTF-8?q?add=20=3F=E2=88=80=20and=20=3F=CE=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tapl/mlish.rkt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tapl/mlish.rkt b/tapl/mlish.rkt index 8056881..1608bde 100644 --- 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 ~?∀