
in the original GitHub fork: https://github.com/ntoronto/racket Some things about this are known to be broken (most egregious is that the array tests DO NOT RUN because of a problem in typed/rackunit), about half has no coverage in the tests, and half has no documentation. Fixes and docs are coming. This is committed now to allow others to find errors and inconsistency in the things that appear to be working, and to give the author a (rather incomplete) sense of closure.
20 lines
734 B
Racket
20 lines
734 B
Racket
#lang typed/racket/base
|
|
|
|
(require (for-syntax racket/base racket/syntax syntax/strip-context))
|
|
|
|
(provide req/prov-uniform-collection)
|
|
|
|
(define-syntax (req/prov-uniform-collection stx)
|
|
(syntax-case stx ()
|
|
[(_ module collection type)
|
|
(with-syntax ([require-it-name (datum->syntax stx (gensym 'require-it))])
|
|
(syntax/loc stx
|
|
(begin
|
|
(define-syntax (require-it-name stx1)
|
|
(syntax-case stx1 ()
|
|
[(require-it-name)
|
|
(with-syntax ([(obj (... ...)) (replace-context #'require-it-name collection)])
|
|
#'(begin (require/typed module [obj type] (... ...))
|
|
(provide obj (... ...))))]))
|
|
(require-it-name))))]))
|