|
|
|
@ -3,7 +3,6 @@
|
|
|
|
|
(provide define+provide+safe+match)
|
|
|
|
|
|
|
|
|
|
(require racket/match
|
|
|
|
|
syntax/parse/define
|
|
|
|
|
(for-syntax racket/base
|
|
|
|
|
racket/syntax
|
|
|
|
|
syntax/parse
|
|
|
|
@ -32,14 +31,16 @@
|
|
|
|
|
[(stx-pair? stx)
|
|
|
|
|
(datum->syntax stx (cons id (stx-cdr stx)) stx stx)])))
|
|
|
|
|
|
|
|
|
|
(define-syntax-parser define+provide+safe+match
|
|
|
|
|
(define-syntax define+provide+safe+match
|
|
|
|
|
(λ (stx)
|
|
|
|
|
(syntax-parse stx
|
|
|
|
|
|
|
|
|
|
[(d (head . args)
|
|
|
|
|
contract:expr
|
|
|
|
|
value-body:expr ...+
|
|
|
|
|
#:match-expander match-transformer:expr)
|
|
|
|
|
#:with fn-expr (syntax/loc this-syntax (λ args value-body ...))
|
|
|
|
|
(syntax/loc this-syntax
|
|
|
|
|
#:with fn-expr (syntax/loc stx (λ args value-body ...))
|
|
|
|
|
(syntax/loc stx
|
|
|
|
|
(d head contract fn-expr #:match-expander match-transformer))]
|
|
|
|
|
|
|
|
|
|
[(_ name:id
|
|
|
|
@ -72,5 +73,5 @@
|
|
|
|
|
(make-name-match-transformer (quote-syntax contract-name))
|
|
|
|
|
(variable-like-transformer (quote-syntax contract-name)))
|
|
|
|
|
|
|
|
|
|
(provide name)))])
|
|
|
|
|
(provide name)))])))
|
|
|
|
|
|
|
|
|
|