Help: I can't get contract-in to work!

I'm trying to bring in some functions from a relative file using contract-in with Racket v8.13 [cs]. Nothing I've tried seems to work. The doc says

([contract-in] require-spec contract-in-item ...)
where require-spec is as in require and
contract-in-item = [id contract-expr]

yet nothing I've tried works. For example

(contract-in
  "sprites-worlds-game.rkt"
  [make-universe (-> universe?)])

gives the error message

contract-in: illegal use of syntax
  value at phase 1: #<rt> in: (contract-in "sprites-worlds-game.rkt" (make-universe (-> universe?)))

How can I use contract-in correctly?

1 Like

Hi, @Greg_Davidson.

I think you might be missing a require, if I am not mistaken?

(require (contract-in
          "sprites-worlds-game.rkt"
          [make-universe (-> universe?)]))

Note the bit in the docs about "via require".

I hope that helps.

Thank you, I can make that work for my needs. I'll file a bug report on the documentation (as soon as I figure out how) as I've now found multiple inaccuracies there! :wink:

1 Like