typed-racket/typed-racket-test/succeed/unit-typed-untyped-compound-2.rkt
Daniel Feltey 2e0cc095c7 Initial support for typed units in typed racket.
Most unit forms are supported, including most of the "infer" forms that
infer imports/exports/linkages from the current context.

Notably, none of the structural linking forms for units are supported, and
`define-unit-binding` is also currently unsupported.
2015-09-10 16:32:11 -05:00

23 lines
568 B
Racket

#lang racket
(module untyped racket
(provide (all-defined-out))
(define-signature x^ (x))
(define u (unit (import x^) (export) (lambda (n) (+ n x)))))
(module typed typed/racket
(require/typed (submod ".." untyped)
[#:signature x^ ([x : Integer])]
[u (Unit (import x^) (export) (-> Integer Integer))])
(define v (unit (import) (export x^) (define x 11)))
(define w (compound-unit
(import)
(export)
(link (([X : x^]) v)
(() u X))))
(define f (invoke-unit w))
(f 6))
(require 'typed)