Created
April 3, 2017 15:11
-
-
Save iitalics/b8871228f9697473bd04ad068fbf33a9 to your computer and use it in GitHub Desktop.
General syntax classes for types (base type, type constructor, binding type)
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-class base-type | |
#:attributes (name internal-name) | |
(pattern ((~literal #%plain-app) internal-name:id) | |
#:with (_ ... name) (syntax-property this-syntax 'orig))) | |
(define-syntax-class ctor-type | |
#:attributes (name internal-name [arg 1]) | |
(pattern ((~literal #%plain-app) internal-name:id | |
((~literal #%plain-lambda) () | |
((~literal #%expression) . _) | |
arg ...)) | |
#:with (_ ... (name . _)) (syntax-property this-syntax 'orig))) | |
(define-syntax-class bind-type | |
#:attributes (name internal-name [bv 1] [arg 1]) | |
(pattern ((~literal #%plain-app) internal-name:id | |
((~literal #%plain-lambda) (bv:id ...) | |
((~literal #%expression) . _) | |
arg ...)) | |
#:with (_ ... (name . _)) (syntax-property this-syntax 'orig))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment