I'm hitting an error when trying to pass values between typed and untyped code. I've shrunk the error to the following test code. Consider three files 'sim-structs', 'sim.rkt', and 'test-sim.rkt'. sim-structs and sim are written in Typed Racket, and test-sim is written in regular racket.
;; sim-structs.rkt #lang typed/racket/base (provide (all-defined-out)) (define-struct: machine ([env : (Listof Any)])) #:transparent) (define-struct: toplevel ([vals : (Vectorof Any)]) #:transparent) ;; sim.rkt #lang typed/racket/base (require "sim-structs.rkt") (provide new-machine) (: new-machine ( -> machine)) (define (new-machine) (make-machine (list (make-toplevel (vector 'foobar))))) ;; test-sim.rkt #lang racket (require "sim.rkt" "sim-structs.rkt") (toplevel-vals (first (machine-env (new-machine)))) When I try to execute test-sim, it fails with the following error: tesla ~/work/js-sicp-5-5 $ /pro/plt/software/racket/5.1/std/bin/racket test-sim.rkt contract violation: expected <toplevel?>, given: #<Typed Value: #(struct:toplevel #(foobar))> contract on toplevel-vals24 from (file /home/dyoo/work/js-sicp-5-5/sim-structs.rkt) via (file /home/dyoo/work/js-sicp-5-5/test-sim.rkt) blaming (file /home/dyoo/work/js-sicp-5-5/sim.rkt) contract: (-> toplevel? (vectorof Any)) at: /home/dyoo/work/js-sicp-5-5/sim-structs.rkt:11.16 === context === /pro/plt/software/racket/5.1/std/collects/racket/contract/private/blame.rkt:58:0: raise-blame-error /home/dyoo/work/js-sicp-5-5/test-sim.rkt: [running body] It looks as though there's some special "Typed Value" wrapper there that shouldn't be visible from the untyped test-sim code. Is there a workaround? _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users