(module unit mzscheme
(require (lib "unit.ss"))
(define-syntax (new-unit stx)
(syntax-case stx ()
[(new-unit sig [export-name binding] ...)
(with-syntax ([(tmp ...) (generate-temporaries (syntax->list #'(export-name ...)))])
#'(let ([tmp binding] ...)
(unit
(import)
(export sig)
(define export-name binding) ...)))]))
(define-syntax functor
(syntax-rules ()
[(functor formals (sig-ids ...) link-specs ...)
(lambda formals
(compound-unit
(import)
(export sig-ids ...)
(link link-specs ...)))]))
(define-syntax require-unit
(syntax-rules ()
[(_ expr sigs ...)
(define-values/invoke-unit expr
(import)
(export sigs ...))]))
(provide (all-defined))
(provide (all-from (lib "unit.ss"))))