#lang typed/racket

(define-signature yz-sig ([y : Integer] [z : Integer]))

(let ((y 1)
      (z 10))
  (define u (unit (import) (export yz-sig)
                  (define y 2)
                  (define z 3)))
  (define u1 (unit (import) (export)
                   y))
  (define u2 (unit (import (only yz-sig z)) (export)
                   y))
  (define u3 (unit (import (except yz-sig y)) (export)
                   y))
  (define u4 (unit (import (prefix s: yz-sig)) (export)
                   y))
  (define u5 (unit (import (rename yz-sig (r y))) (export)
                   y))
  (define u6 (unit (import yz-sig) (export)
                   y))
  (: l (-> (Unit (import yz-sig) (export) Integer) Integer))
  (define (l x)
    (invoke-unit
     (compound-unit (import) (export)
                    (link (((YZ : yz-sig)) u)
                          (() x YZ)))))
  (invoke-unit u1)
  (l u2)
  (l u3)
  (l u4)
  (l u5)
  (l u6))
